views:

36

answers:

1

Hello,

I'm databinding a radiobuttonlist with a LINQ query like so:

var query = from m in Db.Udt_Menu
     orderby m.Name
     select m;

  this.radMenuSelection.DataValueField = "menuID";
  this.radMenuSelection.DataTextField = "name";
  this.radMenuSelection.DataSource = query;
  this.radMenuSelection.DataBind();

However, when i want to update the record I need to set the selectedindex of the radiobutton to a value from the database. There is a table called udt_PageMenuSelection which has a column called menuID which is a foreign key to udt_Menu.menuID.

When i want to update an existing record, how do i set the selectedindex of the radiolist to the value equal to udt_PageMenuSelection.menuID ?

Do I need to do an additional query?

Thanks higgsy

A: 

Hey,

I think I understand the structure, and yes it seems the best way to do things; the udt_Menu entity would have a relationship to udt_PageMenuSelection as a one to many relationship, and you could use LoadWith<> to load those, but that is overkill since I think you are talking loading one record. It would be best to just query it separately.

HTH.

Brian