/// <summary> /// 控件绑定事件 /// </summary> private void RepeaterBindEvent() { this.TrRept.ItemDataBound += (rept, reptEvent) => { ReptBindItem item = reptEvent.Item.DataItem as ReptBindItem; DropDownList ddlAdd = reptEvent.Item.FindControl("ddlAdd") as DropDownList; DropDownList ddlDel = reptEvent.Item.FindControl("ddlDel") as DropDownList; DropDownList ddlUpdt = reptEvent.Item.FindControl("ddlUpdt") as DropDownList; DropDownList ddlQuery = reptEvent.Item.FindControl("ddlQuery") as DropDownList; ddlAdd.DataBind(SelectSource(item.PrivilegeMode), item.addRight.ToString()); ddlDel.DataBind(SelectSource(item.PrivilegeMode), item.delRight.ToString()); ddlUpdt.DataBind(SelectSource(item.PrivilegeMode), item.updtRight.ToString()); ddlQuery.DataBind(SelectSource(item.PrivilegeMode), item.queryRight.ToString()); }; }
public List <ReptBindItem> GetReptBindItem() { var itemList = RightSource as List <ReptBindItem>; ReptBindItem rept = null; for (int i = 0; i < itemList.Count; i++) { rept = itemList[i]; DropDownList ddlAdd = this.TrRept.Items[i].FindControl("ddlAdd") as DropDownList; DropDownList ddlDel = this.TrRept.Items[i].FindControl("ddlDel") as DropDownList; DropDownList ddlUpdt = this.TrRept.Items[i].FindControl("ddlUpdt") as DropDownList; DropDownList ddlQuery = this.TrRept.Items[i].FindControl("ddlQuery") as DropDownList; rept.addRight = Convert.ToInt32(ddlAdd.SelectedValue); rept.delRight = Convert.ToInt32(ddlDel.SelectedValue); rept.updtRight = Convert.ToInt32(ddlUpdt.SelectedValue); rept.queryRight = Convert.ToInt32(ddlQuery.SelectedValue); } return(itemList); }