Which control caused cross-page postback?

J

Jason Wilson

I have a page that has two seperate buttons that have the same
PostbackUrl. How can I tell which button cause the cross-page
postback?

I posted this before and got the anser sender. Sender.ToString doesnt
have the ID of the control causing the cross-page postback.

Jason
 
G

Gozirra

To get the ID, you would need to cast the sender object to the
appropriate type and then ask for the ID property.

This should work.

// Cast sender as web control and get the ID
if ( ((System.Web.UI.Control)sender).ID == "Fred" )
DoFred();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,173
Latest member
GeraldReund
Top