Any way to tell what control raised the postback?

M

MattB

I have a form with multiple text boxes on it and one of several can
raise a postback event. Is there a way to easily tell which one raised
the event? Thanks!

Matt
 
D

darrel

I have a form with multiple text boxes on it and one of several can
raise a postback event. Is there a way to easily tell which one raised
the event? Thanks!

Each item can have an event handler, so one option is to just put your logic
in each individual event handler.

-Darrel
 
M

MattB

darrel said:
Each item can have an event handler, so one option is to just put your logic
in each individual event handler.

-Darrel

Thanks for the response. I wasn't aware TextBoxes could have event
handlers, I've only used them with various bound controls. I'll look
into it.

Matt
 
B

Bruce Barker

text boxes use javascript to postback, so you can look in th hidden field
"__EVENTTARGET" to get the name of the control.

-- bruce (sqlwork.com)
 
D

darrel

Thanks for the response. I wasn't aware TextBoxes could have event
handlers, I've only used them with various bound controls. I'll look
into it.

Ah, yea, you are correct. You'd have to use javascript to do that with the
textboxes.

Hmm...I dunno. I'm stumped. (Though, I have to ask, what are you doing with
the postback of a textbox...is this perhaps something you could/should just
leave client side with javascript?)

-Darrel
 
M

MattB

darrel said:
Ah, yea, you are correct. You'd have to use javascript to do that with the
textboxes.

Hmm...I dunno. I'm stumped. (Though, I have to ask, what are you doing with
the postback of a textbox...is this perhaps something you could/should just
leave client side with javascript?)

-Darrel

Mostly because I'm lazy, and I'm better at server-side (VB) than
client-side coding. It's an Intranet application so the bandwidth for
postbacks isn't critical.

Thanks!
Matt
 
D

darrel

Mostly because I'm lazy, and I'm better at server-side (VB) than
client-side coding. It's an Intranet application so the bandwidth for
postbacks isn't critical.

Maybe just trigger the postback with a different control? Submit button or
something?

-Darrel
 
G

Guest

if you need to differntiate you may want to put the specific code into the
individual controls events....
 

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,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top