K
Keith Patrick
I have a web page that has a bunch of usercontrols, each declaring a Button
called "GoButton". Now, my parent page has to be able to determine which
button triggered the event. The catch is: I'd like to use the same
algorithm for every control, and right now, my algorithm is "sender =
this.FindControl(Request["__EVENTTARGET"]", but the problem is that those
buttons always get rendered as type="submit", even if I assign a CommandName
and/or CommandArgument, leading the Request["__EVENTTARGET"] for Button
presses to be String.Empty.
The event itself has the sender, but that code is in the usercontrol, not
the page. What this means for me is that I could hack in a solution via
temporary variables or passing a sender ID in the QueryString, but I'd much
rather find a way to crack the Button rendering and just have it render as
type="button" where onclick="javascript:__doPostBack(...)" just like every
other control I've got to handle.
called "GoButton". Now, my parent page has to be able to determine which
button triggered the event. The catch is: I'd like to use the same
algorithm for every control, and right now, my algorithm is "sender =
this.FindControl(Request["__EVENTTARGET"]", but the problem is that those
buttons always get rendered as type="submit", even if I assign a CommandName
and/or CommandArgument, leading the Request["__EVENTTARGET"] for Button
presses to be String.Empty.
The event itself has the sender, but that code is in the usercontrol, not
the page. What this means for me is that I could hack in a solution via
temporary variables or passing a sender ID in the QueryString, but I'd much
rather find a way to crack the Button rendering and just have it render as
type="button" where onclick="javascript:__doPostBack(...)" just like every
other control I've got to handle.