new to the asp.net world, so pardon my ignorance. I have a radiobutton list
control, a couple dropdown list controls, and a grid control on the form.
When the user selects items from the list controls, the grid would update
with the proper data. Originally I was handling loading the proper data into
the controls during the postback and wanted to know which one caused the
post-back, so I could take different action during the post-back. I think I
just started down this path and just didn't see the simpler solution. Thanks
for pointing me back in the right direction.
For curiosity sake, I still am wondering if there are rules to the value
returned by
page.Request.Params.Get("__EVENTTARGET");
thanks
--
dchillman
"Marina" wrote:
> Why do you need to figure this out?
>
> Handle the events of the various controls, the click for the buttons,
> selectedindexchanged for the dropdowns, etc.
>
> "dchillman" <> wrote in message
> news:F56C731F-6973-4673-9459-...
> > 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
> >
> >
> > --
> > dchillman
>
>
>
|