G
Guest
string ctrlname = page.Request.Params.Get("__EVENTTARGET");
if (ctrlname != null && ctrlname != string.Empty)
{
return this.Page.FindControl(ctrlname);
}
I have a form on which I was trying to determine which user-action caused a
postback. In various places I found the code above that works for most
controls.
The problem I have been having is with radiobutton list control. A value
for "ctrlname" will be found, but this.Page.FindControl(ctrlname) returns a
null value. The problem appears to be related to the value for ctrlname that
is returned. Its construction appears to be related to the type of control.
Dropdown list controls seem to have the format
pagename:controlname
while my radiobutton list control has the format
pagename_controlname_n, where n is 1, 2, 3, ....
For my needs, I wrote code to extract the real control name which is then
passed to the Page.FindControl method.
My question has to do with the values returned by
page.Request.Params.Get("__EVENTTARGET");
Are there rules for how it constructs the value it returns for each type of
control, and if so, where can I find them?
Thanks
if (ctrlname != null && ctrlname != string.Empty)
{
return this.Page.FindControl(ctrlname);
}
I have a form on which I was trying to determine which user-action caused a
postback. In various places I found the code above that works for most
controls.
The problem I have been having is with radiobutton list control. A value
for "ctrlname" will be found, but this.Page.FindControl(ctrlname) returns a
null value. The problem appears to be related to the value for ctrlname that
is returned. Its construction appears to be related to the type of control.
Dropdown list controls seem to have the format
pagename:controlname
while my radiobutton list control has the format
pagename_controlname_n, where n is 1, 2, 3, ....
For my needs, I wrote code to extract the real control name which is then
passed to the Page.FindControl method.
My question has to do with the values returned by
page.Request.Params.Get("__EVENTTARGET");
Are there rules for how it constructs the value it returns for each type of
control, and if so, where can I find them?
Thanks