protected void ListBind() { string queryStr = "select * from tbMeetingRoom"; SqlConnection con = new SqlConnection(connStr); con.Open(); SqlDataAdapter sda = new SqlDataAdapter(queryStr, con); DataSet ds = new DataSet(); sda.Fill(ds); UserInfoList.DataSource = ds; UserInfoList.DataBind(); con.Close(); }
protected void ListBind() { UserInfoList.DataSource = CreateSource(); UserInfoList.DataBind(); NextPage.Enabled = true; PrevPage.Enabled = true; if (CurrentPage == (PageCount - 1)) { NextPage.Enabled = false; } if (CurrentPage == 0) { PrevPage.Enabled = false; } lblCurrentPage.Text = (CurrentPage + 1).ToString(); }
//列表绑定 private void ListBind() { //筛选条件 var FilterFields = new List <ListFilterField>(); if (!string.IsNullOrWhiteSpace(inpFilter.Text.Trim())) { FilterFields.Add(new ListFilterField { Name = "Name", CmpareMode = FilterCmpareMode.Like, Value = new List <string>(inpFilter.Text.Trim().Split(' ')) }); } //排序字段 var OrderByFields = new List <ListOrderField>(); foreach (string item in new string[] { "ListOrderByID", "ListOrderByName", "ListOrderByStateID", "ListOrderByUpdateTime" }) { GetOrderByField(UserInfoList, item, OrderByFields, out OrderByFields); } //显示列表页 var userInfos = Ziri.BLL.SYS.User.GetUserInfos(FilterFields, OrderByFields , UserInfoListPager.PageSize, UserInfoListPager.PageIndex, out long rowCount, out AlertMessage alertMessage); UserInfoList.DataSource = userInfos; UserInfoList.DataBind(); UserInfoListPager.RowCount = rowCount; //提示信息 if (alertMessage != null) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "ListMessage" , string.Format("<script> swal('{0}', '', '{1}'); </script>", alertMessage.Message, alertMessage.Type)); } }