.net freak

This site

Sponsors

  • MaximumASP
  • Social Bookmarking
    Online Shopping
    asp.net hosting
    UK online local dating

Difference between Page.ClientScript.RegisterStartupScript and ClientScript.RegisterClientScriptBlock ?

The main difference between the two is that, RegisterStartupScript places the script at Bottom of page and RegisterClientScriptBlock at the Top of the page.

                So what’s the big deal in both these scenarios. Well, the main use of these two depends upon the situation for which we want to use.

               Take an example of a javascript function that populates a Textbox using a javascript function when a page is loaded. If you use the RegisterClientScriptBlock method, the javascript function will give an error. This is because your script is placed at the top of the page when it was loaded (when the textbox was not even created). So how can it find the textbox and populate the values. Sp in this case RegisterStartupscript should be used.


So use of any of the above function depends upon type of script.

 

Posted: Sep 10 2010, 02:08 PM by jasminder | with no comments
Filed under:

Comments

No Comments