Skip to main content

__doPostBack


yes it is javascript function..eventhough i never used any but it used at my web..

it act amazing (well i'm still new :D)
to me the __dopostback (with 2 underscore at front) is like a function that call an ID of an control (.NET in my case) so it can execute the code behind those control

ex: i have one link button that with ID 'Delete' and a javascript
function that would prompt user wether he/she want to delete it and also Delete_Click sub at code behind

function Delete()
{
if (confirm(
'Do you want to delete the selected folder(s) and/or file(s)?'))
{
__doPostBack('Delete', '');
}
}

and a linkbutton that call Delete_OnClick sub at the code behind page

so it works like this:
1. it will executed the javascript function, prompt for "Do u want bla222"

2. if already confirm then it will search for a control ID and execute the event for coressponding control..since it only have OnClick event in my case so it execute the "Delete_Click" sub

3. u need to define a Delete_Click sub at code behind which is pagename.aspx.vb in my case..

the magic happened hehehe.hope all of u can understand what i mean..visit this site which make me understand about it a little than before..a little much :shy:

until then

Comments

Rudi said…
Dooh, that javascript func. remind me to a VB6 app. that I wrote couples months ago, an app. that doing extracting bunch of data stored on a table in an ASP.NET powered website(thanks to WebBrowser control :D), they use that func. for their results paginating links.
First time I'm encountering it when it's confusing me for extracting data from page to page, until I examining the codes behind it(the __doPostBack func. stored on every aspx page which use it) and just figure it out that it's just used to split the first string argument variable with '$' as escape sequence, then join them with ':' as new escape sequence, dunno why it have to do like that, perhaps purposed for some object model traversing or anythings else, dunno exactly what's quirks behind it :D.
Anyway it's give me clues on how to treat them on my app. VB6 codes, just Replace() '$' char with ':' then submit the form, voila, problem solved :D.
Well I think it's preety handy and quite cool func. thought, perhaps by combining it with AJAX tech. could make it better, 'cause for current state, it refresh the whole page every time that func. executed,
by using AJAX, we just need to refresh specific page's portion, maybe it would look like: __doPostBack('Display', '', 'DataDisplay'), and when it's executed, let say a div tag with id="DataDisplay" will refreshed it's contents to portions of data that retrieved from an another aspx page that handling Display_Click() func., uhmmm.. that sounds really tasty, yummy... :D.
eRiCk said…
..and just figure it out that it's just used to split the first string argument variable with '$' as escape sequence, then join them with ':' as new escape sequence -> i've read somewhere about that one..but not intrested in the detail :D

by using AJAX, we just need to refresh specific page's portion, maybe it would look like: __doPostBack('Display', '', 'DataDisplay'), and when it's executed, let say a div tag with id="DataDisplay" will refreshed it's contents to portions of data that retrieved from an another aspx page that handling Display_Click() func., uhmmm.. that sounds really tasty, yummy... :D. -> hm..u saying AJAX is a food??? o noo.it's new to me :D

never tried AJAX..guess it's next when the Web is finish

about the div tag, i never learn HTML before so not sure what it is for..i guess it's a function for the HTML Table so i have some column or somehthing and it works for IE 5.x and above? am i right?

plz correct me if i'm wrong also always if u have some usefull link..plz tell me..i promise i'll be a good boy :D

EDIT: i've read w3school but still confuse :D
Rudi said…
Never learn HTML before?? but how could you do those web app. codings, whoaa you're amazing dude, me myself have to learn those HTML & CSS gimnicks before I learn dynamic web app. with PHP, well I'm salute you bro :D.

Remind me with one of my workmate, she really got indulge to learn web app. development, but all she got in her mind was HTML is DreamWeaver, hohoho.. how childish was thought that you have THONK(dooh how rude I'am :D)

No, div tag was used for grouping couples HTML tag elements, it get famous among tableless CSS-based web designers out there, have a look for couples of their awsome works at CSS Zen Garden.
eRiCk said…
well i learn the html by code it..first i'm not sure what this mean but after sometimes..i know how to make HTML Table..
tr, td, br tags, etc..just the simple one i think..

ut all she got in her mind was HTML is DreamWeaver, hohoho..-> o noo..HTML girl :D..well at least she already focused her mind not like me

thx for the explanation about div but still can't understand it until i figured it out how..:D
Rudi said…
Dunno if you already know this, but there's a nice article 'bout how __doPostBack works in ASP.NET.
eRiCk said…
thx rudi lee

yes i've read the article before, indeed a nice one :D

Popular posts from this blog

SBO - Internal Error (-5002) Occured in Inventory Transfer

this is something that not well documented in SBO, it took me several hours to look at Google and can't find anything about it. Thank God friend of mine got answer for this one.So the Sympton is something like this, u need to make Inventory Transfer for Batch Item and Serial Item in one single Transaction so the Transaction is the combination of it. ex in detail lines: 1. Serial Item 2. Batch Item 3. Batch Item 4. Batch Item 5. Serial Item 6. Serial Item . When u reach this code oStockTransfer.Add it will return an error "Internal Error (-5002) Occured". This is because ur details is not in order, meaning u need to order the line with combination of Batch first then Serial or Serial first then Batch so be careful with this thing :D see u

Crystal Report 2010 - Failed to load database information

"Failed to load database information" error when i try deploy my program with CR 2010 using TTX file as report definition this is because there is missing .dll, call "CRDB_FIELDDEF.DLL"..u need to manually copy the file to "C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86" folder then the report is loading again it said that TTX is old tech but i'm still using it because i don't need to connect the report to any DB, but until i found new one to replace :D check this link to read it [EDIT 25 Jan 2011] i think i'll using ADO.NET Dataset next time :D until then

Resolve Collation error in SQL Server

i often get this error when trying to JOIN some table Cannot resolve the collation conflict between "SQL_Latin1_General_CP850_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. u need to use COLLATION when performing the JOIN, something like this SELECT field1 FROM table1 INNER JOIN table2 ON table1.field3 COLLATE DATABASE_DEFAULT = table2.field4 COLLATE DATABASE_DEFAULT i found this when trying to JOIN, maybe it affect other areas..until i found one see u