private void BindDisplayList(int pageIndex) { DataTable tb; if (HiddenField2.Value == "0") { tb = HPassWorkLogDataDBOption.DataTableSelect_addrownum(); } else if (HiddenField2.Value == "1") { tb = HPassWorkLogDataDBOption.DataTableSelect_byID(TextBox1.Text); } else { tb = HPassWorkLogDataDBOption.DataTableSelect_byID(DropDownList1.Text); } WFWebLib.GridViewOperation.BindPagingGridView(GridView1, tb.DefaultView, pageIndex); }
protected void Page_Load(object sender, EventArgs e) { if (HiddenField1.Value == null || HiddenField1.Value == "1") { HiddenField1.Value = ""; BindDisplayList(); } if (!IsPostBack) { DropDownList1.Items.Clear(); DropDownList1.Items.Add("请选择"); DataTable dt = DeviceInfoDataDBOption.DataTableSelect(); for (int i = 0; i < dt.Rows.Count; i++) { DropDownList1.Items.Add(dt.Rows[i]["ID"].ToString()); } //保存当前查询状态 DataTable tb = HPassWorkLogDataDBOption.DataTableSelect_addrownum(); BindDisplayList(); } }