Thursday, September 18, 2008

Finding which button clicked

If you want to know which button is being click befor the button click event there is a function which you will have to override.

override protected void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
    {
        string s = ((WebControl)sourceControl).ID;
        Response.Write(s.ToString());
       
    }

This event is fired after page lod and before button click event.
Using this event one can find that due to which control post back occured.

No comments: