Wednesday, September 29, 2010

How to write javascript in Code behind using C#

Many client-side tasks, such as tracking mouse events, setting page focus, displaying/hiding a section of page, was not directly supported by asp.net, this is happen because of server side operation. If we want to prevent the post-back and quickly we want to add or remove the content in the page we have to depend up on the JavaScript. So in asp.net using server code we can include the java script code by using Page.RegisterStartupScript

just include the following line to set the focus on the particular control during the time of page load.



I call the function where and when you want it. I call it at page load Event.

No comments:

Post a Comment