how do i know which web controls sent the request.
-
Hi All, Is there a way to do this: if a request is from a manual item, then re-fetch the data from database, and if a request is from the other web controls, say link button, then do not re-fetch data from database. Thanks very much.
-
I guess you could use __EVENTTARGET to identify the control that caused the post-back. i.e. the control that sent the current request. http://forums.asp.net/t/1352215.aspx[^]
Cheers, Karthik
Thanks very much for your reply, and you did point me in the right direction Here is the trick: Request.Params["__EVENTTARGET"].contains("xx"); xx is the control name (it's obficates, but still humna readable, such as: ctl00$AccordionMenu1$ctl15$clb0). the "AccordionMenu1" is the name of a user control, but u can but the other controls too, e.g. link button etc.
-
Thanks very much for your reply, and you did point me in the right direction Here is the trick: Request.Params["__EVENTTARGET"].contains("xx"); xx is the control name (it's obficates, but still humna readable, such as: ctl00$AccordionMenu1$ctl15$clb0). the "AccordionMenu1" is the name of a user control, but u can but the other controls too, e.g. link button etc.
Great, you are welcome! And, hopefully you might know this, just in case, you could get this value "ctl00$AccordionMenu1$ctl15$clb0" using <accordion_id>.ClientID (AccordionMenu1.ClientID in code-behind) in the server side or using '<%= AccordionMenu1.ClientID %>' (for use in javascript)
Cheers, Karthik
-
Hi All, Is there a way to do this: if a request is from a manual item, then re-fetch the data from database, and if a request is from the other web controls, say link button, then do not re-fetch data from database. Thanks very much.
If you are using postbacks, the simple way is to inspect the sender variable in your event handler. This identifies the control that actually triggered the postback. It really is that simple.
I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be
Forgive your enemies - it messes with their heads