In c#, how can I check to see if a link button has been clicked in the page load method? I need to know if it was clicked before the click event is fired.
+2
A:
Check the value of the request parameter __EVENTTARGET to see if it is the id of the link button in question.
tvanfosson
2008-10-09 18:35:21
+4
A:
if( IsPostBack )
{
// get the target of the post-back, will be the name of the control
// that issued the post-back
string eTarget = Request.Params["__EVENTTARGET"].ToString();
}
Jared
2008-10-09 18:35:52
Did you test this? Should have two leading slashes - "__EVENTTARGET"
Tsvetomir Tsonev
2008-10-09 18:39:11
yup just caught that myself, thanks!
Jared
2008-10-09 18:40:12
+2
A:
The UniqueID of the button will be in Request.Form["__EVENTTARGET"]
Tsvetomir Tsonev
2008-10-09 18:36:56