Last post Aug 29, 2009 07:57 AM by ebrahim_464
Aug 27, 2009 08:28 AM|ebrahim_464|LINK
i need ur help, i had a problem with my custom grid. the grid grts th recordes from the data source and display them as table, the frist column of this table is input of type checkbox when one check it the event selected index changed is raised. the problem
is that i want to know which input cause the post back. i give each one of them a unique name in render method i want to get this name for the one checked by the user.
please somebody help me.
Aug 27, 2009 08:59 AM|atconway|LINK
Check out this link:
Determining the Control that Caused a PostBack:
Aug 29, 2009 07:45 AM|ebrahim_464|LINK
thanks atconway for replay but there are some limitaion for this method :
1-a composite control may have many child controls which can
post back, and __EVENTTARGET may only name a single hidden field located in
front of all of those child controls. The composite control might then use
__EVENTARGUMENT to distinguish which child control caused the postback, but
you would be unable to do so.
2-Another issue would be the case where a button causes the postback, but that
it is "clicked" via its accessKey attribute. This button might not be
anywhere near where the user was working when he pressed the access key.
but it works good if u ur control inherit from webcontrol.
Aug 29, 2009 07:57 AM|ebrahim_464|LINK
i think i found the answer ther is a method called
bool OnBubbleEvent(object source, EventArgs args)
it is a virtual method so u can override it
the frist args of theis method(source) is an object which is the
sender of the event if u cast this object
us can access it properties and get its id, so if u give this control a unique id from the begining
u could know which excatly cause the event.