How to check if a specific control caused postback?
Let's say you have a button ( btnAdd ) among other controls...
To check if it has just caused postback, place the next code in Page_Load event handler:
protected void Page_Load(object sender, EventArgs e)
{
// If button btnAdd is clicked
if (Request.Params.ToString().IndexOf("btnAdd") > 0)
{
// do something here
}
else
{
// do something else
}
}
Revision number 1, Monday, June 16, 2008 7:16:12 AM by marko.pa
This is not the most up to date version of this article. The most recent version can be found here.
You must Login to comment.
|
Mon, Jun 16, 2008 5:21 PM
by Pak514
|
nice
|