nope. It seems that there is no direct method to call a postback from JS. I find people asking for it all over the place though, so I would hope that MS includes it in the next version.
The work around is pretty good though. You basically have two options, I use option #1.
1) Set a hidden field as a trigger. Through JavaScript, update the value of the hidden field. This causes the Ajax postback as desired.
2) I have read about people placing a "submit" button in a hidden DIV and setting that as the trigger. Again, you submit the button via JS.
Let me know if you get stuck and I can send you code.
Thanks for your reply, actually I'm trying to write a control that uses the UpdatePanel. I wrap my control in it and I've tried adding some buttons to the triggers collection, but when I click the button it performs a normal postback. Is there anything special you've found that needs to be done for something like this to cause an ajax postback? What I'm doing here sounds kind of like your second suggestion, but it doesn't seem to work.
Anything INSIDE an Update panel should cause only an "Ajax" postback, and that includes other controls. Make sure you have the attribute Updatemode set to conditional. Like so:
<
asp:UpdatePanelID="UpdatePanel1"runat="server"UpdateMode="conditional">
No comments:
Post a Comment