Peter Chan
asked on
Way to call code-behind event
Hi,
I want to call one code-behind event within one javascript event. Can you please show with one example to this?
I want to call one code-behind event within one javascript event. Can you please show with one example to this?
ASKER
Many thanks Easwaran.
Is it possible to call this
within server-side method?
Is it possible to call this
ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
within server-side method?
ASKER
I have tried it and have got that it is no possible to execute ClientScript within server-side method. How to resolve this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I really don't have time to confirm if this is surely the answer or not.
You can't call the asp.net life cycle methods such as page_load. Instead, you could write the server side method as webservice and call it in either javascript or ajax. Following links could be helpful.
http://aspsnippets.com/Articles/Calling-server-side-methods-using-JavaScript-and-JQuery-in-ASP.Net.aspx
http://www.morgantechspace.com/2014/01/Call-Server-Side-function-from-JavaScript-in-ASP-NET.html
HTH.