Call a server side event from javascript
ASP.NET
4
Posts
4
Posters
0
Views
1
Watching
-
Hi I want a server side event(e.g aspButton1.Click) to be called from a javascript.How can I do this?
ARINDAM
-
Hi I want a server side event(e.g aspButton1.Click) to be called from a javascript.How can I do this?
ARINDAM
-
Hi I want a server side event(e.g aspButton1.Click) to be called from a javascript.How can I do this?
ARINDAM
Hi Arindam, Try to use CallBack and Ajax. Check This link http://www.codeproject.com/KB/aspnet/clientcallback.aspx[^]
cheers, Abhijit Check My Latest Article
-
Hi I want a server side event(e.g aspButton1.Click) to be called from a javascript.How can I do this?
ARINDAM
Try this Javascript :
__doPostBack('RAISE_Your_Event','specify_argument_here_if_needed');
ASPX.CS Page_Load Event:
if (this.IsPostBack) { // Insure that the \_\_doPostBack() JavaScript method is created... this.GetPostBackEventReference(this, string.Empty); string eventTarget = (this.Request\["\_\_EVENTTARGET"\] == null) ? string.Empty : this.Request\["\_\_EVENTTARGET"\]; if (eventTarget == "RAISE\_Your\_Event") { string argumentValue = (this.Request\["\_\_EVENTARGUMENT"\] == null) ? string.Empty : this.Request\["\_\_EVENTARGUMENT"\]; } }
"Change is permanent, somethings never change!"