Suresh Behera

The Microsoft .Net Junkies

News

Blogroll

Reading

September 2007 - Posts

How to makeuse of IsPostPack Method inside UserControl?

How to makeuse of IsPostPack Method inside UserControl? 

IsPostBack method will always be true inside user control. You can use following alternate method to by pass this isse

 protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
if (!IsUserControlPostBack)
{
///Write your code
}
}

//Make ReadOnly property.

protected bool IsUserControlPostBack{
get
{
   return this.ViewState["IsUserControlPostBack"] != null;
}

Hope this help..

Suresh Behera

More Posts