Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

__doPostback

Status
Not open for further replies.

crazyboybert

Programmer
Jun 27, 2001
798
GB
Hi All

This is not really something I'm having a problem with so much as something i'm wondering about. When you create a control which is not a button but has a postback event, e.g. a dropdownlist with a selectedindexchanged event and autopostback=true, then .NET outputs a client function called __doPostback which is used tot submit the form.

Does anyone know a way to tell .NET output this function regardless of wether it is needed by a webcontrol to handle the postback. Say i had a plain anchor I wished to use to submit the page via the client side onclick event. How can I tell .NET to output the __doPostback function so I can use it to handle the form submit.

Just a thought.

Rob

 
You can't - __doPostback is created by .NET only when you have a control that will automatically do a postback. To submit the form when clicking on a link, use a LinkButton. And if you really need that function, just create your own javascript function that does the same as the .NET generated function. To rely on calling generated code is generally not a good thing.

regards,
Blaxo
 
Cheers Blaxo

As I thought then really - i'm already using my own function to handle the postback for this type of scenario anyway. Was just wondering if you could force .NET to generate the __doPostback on demand as a rather neater way of handling it. Ah well such is life...

Rob

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top