Hi. Here's my problem:
I'm trying to set some items in a ListBox to be checked after the ListBox is databound. My problem is that even though the loop is executed and Visual Studio reports each item I want as checked = true, it doesn't appear to be so. Any suggestions?
rlbRoles.DataBind(); |
stmt = |
@"Select auth_Roles.Name as Name, auth_Roles.NameEL as NameEL from auth_Roles INNER JOIN auth_UserRoles on auth_UserRoles.RoleId = auth_Roles.RoleId INNER JOIN auth_Users on auth_UserRoles.UserId = auth_Users.UserId |
WHERE auth_Users.UserId = @UserId"; |
dt = DbSql.ExecuteDataTable(stmt, |
new List<SqlParameter>(new[] |
{ |
new SqlParameter("@UserId", |
DataBinder.Eval(sender, |
"DataItem.ID")) |
} |
) |
); |
int i = 0; |
foreach (DataRow r in dt.Rows) |
{ |
rlbRoles.FindItemByValue(dt.Rows[i]["Name"].ToString()).Checked = true; |
i++; |
} |