Esempio n. 1
0
 private void createData()
 {
     zs.BLL.Sys_Role       bllr  = new zs.BLL.Sys_Role();
     zs.BLL.Sys_UserRole   bllur = new zs.BLL.Sys_UserRole();
     zs.Model.Sys_UserRole model = new zs.Model.Sys_UserRole();
     foreach (RepeaterItem ri in Repeater1.Items)
     {
         (ri.FindControl("ddl_role") as DropDownList).DataSource     = bllr.GetModelList("");
         (ri.FindControl("ddl_role") as DropDownList).DataTextField  = "RoleName";
         (ri.FindControl("ddl_role") as DropDownList).DataValueField = "ID";
         (ri.FindControl("ddl_role") as DropDownList).DataBind();
         //(ri.FindControl("ddl_role") as DropDownList).SelectedValue =
         string userId = (ri.FindControl("HiddenField1") as HiddenField).Value;
         if (bllur.GetModelList("UserID=" + userId).Count > 0)
         {
             model = bllur.GetModelList("UserID=" + userId)[0];
             (ri.FindControl("ddl_role") as DropDownList).SelectedValue = model.RoleID.Value.ToString();
         }
     }
 }