ISSUE :
 
Profile photo
Submitted by Sam Buchana
on March 30th, 2012 at 13:06:43 EST

Difference between ScriptManager.RegisterClientScriptBlock vs ScriptManager.RegisterStartupScript?

What is the difference between using ScriptManager.RegisterClientScriptBlock vs ScriptManager.RegisterStartupScript? I thought both embeds Javascript to the page during Asyc calls.
Can someone please explain the difference?


Profile photo
Replied by SBajra
on April 4th, 2012 at 13:05:16 EST
ScriptManager.RegisterClientScriptBlock will insert Javascript code towards the end of the page whereas ScriptManager.RegisterStartupScript will insert Javascript in the page Header.
So, use of one vs other is based on where you want to insert Javascript in the page during AJAX calls.
Accepted Answer
Accepted
 Answer