Setting focus on RadioButtonList after postback

  • Thread starter Thread starter TheDrifter
  • Start date Start date
T

TheDrifter

This seems to be one of the great mysteries of ASP.NET as I have seen
numerous postings on this with absolutely no answers. SetFocus does not work
on the RadioButtonList control. Does anybody know the proper way to set the
focus on a RBL after a postback so the user at least knows where they are on
the screen? This cannot be so difficult?
 
This seems to be one of the great mysteries of ASP.NET as I have seen
numerous postings on this with absolutely no answers. SetFocus does not
work
on the RadioButtonList control. Does anybody know the proper way to set
the

Because RadioButtonList has no parallelism in HTML.
It's only the individual items in RadioButtonList - RadioButton - that
figures in HTML and can be focussed.

What you can do is something as follows:

ListItem selectedItem = radioButtonList.SelectedItem;
selectedItem.Attributes.Add("onload", "this.focus();");


HTH
 
Back
Top