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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top