protected void PrivilageGridID_PageIndexChanging(object sender, GridViewPageEventArgs e) { PrivilageGridID.PageIndex = e.NewPageIndex; PrivilageGridID.DataSource = grdList; PrivilageGridID.DataBind(); }
public void SearchFn(int RoleID) { UpdateMenu = true; AddErrorTxt.Text = ""; EditFalg = true; _RolPriv = new Rol_PrivFT(); RolPrivList = new List <Rol_PrivFT>(); privilage _Privilage = new privilage(); grdList = new List <PrGrd>(); try { RolPrivList = db.Rol_PrivFT.Where(item => item.Rol_id == RoleID).ToList(); //foreach (var rp in RolPrivList) //{ // string _PrivilageName = PrivlageNameDict[rp.Priv_id]; // grdList.Add(new PrGrd() // { // Title = _PrivilageName, // AddFlag = rp.AddFlag, // AllFlag = rp.AllFlag, // DeleteFlag = rp.DeleteFlag, // EditFlag = rp.EditFlag, // SearchFlag = rp.SearchFlag, // PrivilageID = rp.Priv_id, // RolPrivFK=rp.ID // }); //} foreach (var rp in PrivlageNameDict) { string _PrivilageName = rp.Value; try { Rol_PrivFT RP = RolPrivList.Where(o => o.Priv_id == rp.Key).First(); grdList.Add(new PrGrd() { Title = _PrivilageName, AddFlag = Convert.ToBoolean(RP.AddFlag), AllFlag = Convert.ToBoolean(RP.AllFlag), DeleteFlag = Convert.ToBoolean(RP.DeleteFlag), EditFlag = Convert.ToBoolean(RP.EditFlag), SearchFlag = Convert.ToBoolean(RP.SearchFlag), PrivilageID = Convert.ToInt32(RP.Priv_id), RolPrivFK = RP.ID }); } catch (Exception ex) { grdList.Add(new PrGrd() { Title = _PrivilageName, AddFlag = false, AllFlag = false, DeleteFlag = false, EditFlag = false, SearchFlag = false, PrivilageID = rp.Key, }); } } PrivilageGridID.DataSource = grdList; PrivilageGridID.DataBind(); } catch (Exception ex) { } }