RadiobuttonList databind

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey,

In ASP.NET I have a Radiobuttonlist server control.
I do databinding to fill up :
this.RBList.DataSource = Methods.Items;
this.RBList.DataTextField = "Desc";
this.RBList.DataValueField = "Id";
this.RBList.DataBind();

this.RBList.SelectedValue = "01";

I want that one of the radiobuttons is as default preselected (the one with a datavalue = "01").

But this.RBList.SelectedValue = "01" don't work. When I go back to the page no radibutton is selected.

How I have to di this?
Thanks in advance
nic
 
Hi

By default first item in radio button list will be selected. Just loop through the items and set selected propery to false. Then select the item which you want.

HTH
 
Back
Top