You need to get the row index in LINQ, then use this value to indicate my DropDownList.SelectedIndex when the page loads or postback.
public String GetRoleName(Int16 RoleID)
{
SQL_TA_SCOREBOARDEntities1 c = new SQL_TA_SCOREBOARDEntities1();
String qry = (from b in c.EmployeeAccessLevels
where b.id == RoleID
select b.Role).FirstOrDefault();
return qry;
}
I take the role name for the dropdown to display, but that still doesn't work.
String RoleName = MyClass.RoleName(RoleID);
ddlRole.Text = RoleName
So, I really need an index.
Thanks in advance!
source
share