posted 12/22/2008 6:01:20 AM by Vivek Thakur
In ASP.NET 2.0, a new class ClientScriptManager is introduced and the old method Page.RegisterClientScriptBlock is deprecated. Below is some sample code to register client script from an ASP.NET page:
if(!ClientScript.IsClientScriptBlockRegistered("ClosePopUp"))
{
ClientScript.RegisterClientScriptBlock(this.GetType(), "ClosePopUp", "your javascript code goes here");
}
Note the GetType() method, I recommend going through this post which sheds more light on the same:
http://blogs.ipona.com/james/archive/2006/10/03/6710.aspx
Vivek Thakur (Member since: 11/27/2008 11:54:25 AM) I am one of the administrators at CodeAsp.Net and I love programming, architecting solutions, code reviews, teaching and writing about ASP.NET.
View Vivek Thakur 's profile
Leave a comment
It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.
enter your email address: