- Using ScriptManager Class.
- Using Page.RegisterClientScriptBlock or Page.RegisterStartupScript or Page.ClientScript object
Page.RegisterClientScriptBlock or Page.RegisterStartupScript methods are deprecated methods and they shouldn’t be used. Microsoft has replaced them with Page.ClientScript object methods.
ScriptManager class can also be used to do the same but with the slight difference, these methods are compatible with Asp.Net AJAX partial post backs where as the Page.ClientScript object methods are not compatible with Asp.Net AJAX.
Also, in ScriptManager class there are various methods to perform this operation.
All these methods have an overload in which one takes Control as first parameter and the other overload takes Page as a first parameter.