How to get Post Back Control ID when using Update panel

Recently, I faced an issue in which I need to get the ID of the control which is responsible for post back inside update panel.

If we are using Update Panel and then we cannot get the post back control id using Request.Form[“__EVENTTARGET”].

We need to use the following code snippet to get the control ID which is responsible for post back.

ScriptManager.GetCurrent(this.Page).AsyncPostBackSourceElementID

The above statement would give the client ID of the element. You can find more information on MSDN

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s