views:

106

answers:

1

I have a user control that is supposed to write a value to a hidden field every time the consuming page posts back.

Is there any way to trap the postback event at the page level? Perhaps I can wire up an event so that I can run a function every time the page posts back.

Thanks.

+1  A: 

You can determine within Page_Load whether an operation is the result of a postback (i'm assuming this is what you mean by "trapping the postback event at the page level".

protected void Page_Load(object sender, EventArgs e)
{
    if (Page.IsPostback)
    {
       //Your code here.

    }
}
Gurdas Nijor