Who is online? 140 guests and 0 members
Member login | Become a member
home » blogs » vivek_iit » RegisterclientScript block in ASP.NET 2.0
posted 12/22/2008 by vivek_iit
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_iit (Member since: 11/27/2008) 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_iit 's profile
Comment (No HTML)
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: