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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top