protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) { FineUIGridCommon.SyncSelectedRowIndexArrayToHiddenField(hides, hidename, Grid1); Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); Grid1.PageIndex = 0; BindData(); }
// 行事件 protected void GridChoose_RowCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "Delete") { string keyid = GridChoose.Rows[e.RowIndex].Values[0].ToString(); var id = hides.Text.Replace("[", "").Replace("]", "").Replace("\"", "").Split(',').ToList(); var name = hidename.Text.Replace("[", "").Replace("]", "").Replace("\"", "").Split(',').ToList(); for (int i = 0; i < id.Count; i++) { if (id[i].ToString() == keyid) { id.RemoveAt(i); name.RemoveAt(i); } } if (hides.Text.Length > 10)//有选择人的数据 { if (id.Count > 0) { string newhides = "["; string newhidename = "["; for (int i = 0; i < id.Count; i++) { newhides += "\"" + id[i].ToString() + "\","; newhidename += "\"" + name[i].ToString() + "\","; } newhides = newhides.Substring(0, newhides.Length - 1); newhidename = newhidename.Substring(0, newhidename.Length - 1); newhides += "]"; newhidename += "]"; hides.Text = newhides; hidename.Text = newhidename; } else { hides.Text = ""; hidename.Text = ""; } } FineUIGridCommon.UpdateSelectedRowIndexArray(hides, Grid1); FineUIGridCommon.SyncSelectedRowIndexArrayToHiddenField(hides, hidename, Grid1); BindData(); LoadGridChoose(); } }
//编辑状态加载数据 private void LoadInfo() { string type = RequestHelper.GetRequestString("id", ""); txttype = type; this.Panel7.Title = "新增"; if (!string.IsNullOrEmpty(type)) { this.Panel7.Title = "修改"; DataTable dt = operate.GetRecommendByTypeName(type); if (dt != null && dt.Rows.Count > 0) { this.txtTypeName.Readonly = true; this.txtTypeName.Text = HttpUtility.HtmlDecode(dt.Rows[0]["TypeName"].ToString()); this.chkFlag.Checked = Convert.ToBoolean(dt.Rows[0]["Flag"]); var id = HttpUtility.HtmlDecode(dt.Rows[0]["PersonID"].ToString()).Split(','); var name = HttpUtility.HtmlDecode(dt.Rows[0]["PersonName"].ToString()).Split(','); string newhides = "["; string newhidename = "["; for (int i = 0; i < id.Length; i++) { newhides += "\"" + id[i].ToString() + "\","; newhidename += "\"" + name[i].ToString() + "\","; } newhides = newhides.Substring(0, newhides.Length - 1); newhidename = newhidename.Substring(0, newhidename.Length - 1); newhides += "]"; newhidename += "]"; hides.Text = newhides; hidename.Text = newhidename; FineUIGridCommon.UpdateSelectedRowIndexArray(hides, Grid1); FineUIGridCommon.SyncSelectedRowIndexArrayToHiddenField(hides, hidename, Grid1); //BindData(); LoadGridChoose(); } else { Alert.ShowInParent("读取数据失败!", String.Empty, ActiveWindow.GetHideReference()); } } }
private void SyncSelectedRowIndexArrayToHiddenField() { // 重新绑定表格数据之前,将当前表格页选中行的数据同步到隐藏字段中 FineUIGridCommon.SyncSelectedRowIndexArrayToHiddenField(hfSelectedIDS, Grid1); }
// 确认事件 protected void btnSubmit_Click(object sender, EventArgs e) { FineUIGridCommon.SyncSelectedRowIndexArrayToHiddenField(hides, hidename, Grid1); LoadGridChoose(); }
protected void Grid1_PageIndexChange(object sender, FineUI.GridPageEventArgs e) { FineUIGridCommon.SyncSelectedRowIndexArrayToHiddenField(hides, hidename, Grid1); Grid1.PageIndex = e.NewPageIndex; BindData(); }