コード例 #1
0
 protected void gvUsers_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DropDownList ddlRole = (e.Row.FindControl("ddlRole") as DropDownList);
         if (ddlRole != null)
         {
             ddlRole.Bind(DBReadManager.GetSecureRoles(), "Description", "RoleId");
         }
         string roleId = (e.Row.FindControl("lblRoleId") as Label).Text;
         ddlRole.Items.FindByValue(roleId).Selected = true;
         e.Row.Cells[6].Enabled = false;
     }
 }