By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,512 Members | 3,745 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,512 IT Pros & Developers. It's quick & easy.

Initiate PostBack From Client-side Script

P: n/a
I'm trying to initiate Postback from client-side script, and here's what I
have that doesn't work: I have an <asp:Button> on the same page named
btnSave that the user can click (its functionality works fine). I want to
call the button's server-side functionality from the client-side script (in
response to things happening in the client other than the user clicking on
the save button).

function DoSomethingInClient()
{
Do Some Stuff Here
__doPostBack('btnSaveClick','');
}

What could be wrong with this?

Thanks.
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Are you sure you have the method __doPostBack() in your client? If you
don't have any controls set for postback, it can happen that the code is not
generated to the client.

In the Framework documentation or MSDN, search for the article titled
"Generating Client-Side Script for Postback."

It talks about the GetPostBackEventReference method. This method will
return method call string so you can use it in programatically generated
client scripts but the most important thing it will do for you is that, if
it doesn't already exist by other means, it will generate the __doPostBack
method itself so that you can call it.

Dale Preston
MCAD, MCSE, MCDBA

"Jordan" <A@B.com> wrote in message
news:ul*************@TK2MSFTNGP11.phx.gbl...
I'm trying to initiate Postback from client-side script, and here's what I
have that doesn't work: I have an <asp:Button> on the same page named
btnSave that the user can click (its functionality works fine). I want to
call the button's server-side functionality from the client-side script (in response to things happening in the client other than the user clicking on
the save button).

function DoSomethingInClient()
{
Do Some Stuff Here
__doPostBack('btnSaveClick','');
}

What could be wrong with this?

Thanks.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.