protected void Button_Search_Click(object sender, EventArgs e) { string teamName = TextBox_TeamName.Text; DateTime time = string.IsNullOrEmpty(TextBox_CreateTime.Text) ? DateTime.Now : Convert.ToDateTime(TextBox_CreateTime.Text); //重新绑定列表绑定的数据. Repeater1.DataSource = dal.GetTruckList(pageIndex, pageSize, teamName, time, out total); Repeater1.DataBind(); //显示页数列表 Repeater2.DataSource = PageDataHelper.GetPageList(total, pageSize); Repeater2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //是否回发 if (!IsPostBack) { string teamName = TextBox_TeamName.Text; DateTime time = string.IsNullOrEmpty(TextBox_CreateTime.Text) ? DateTime.Now : Convert.ToDateTime(TextBox_CreateTime.Text); Repeater1.DataSource = dal.GetTruckList(pageIndex, pageSize, teamName, time, out total); Repeater1.DataBind(); //显示页数列表 Repeater2.DataSource = PageDataHelper.GetPageList(total, pageSize); Repeater2.DataBind(); } }
/// <summary> /// /// </summary> public void SearchUsers() { //获取搜索参数 string account = TextBox_Account.Text; string time = TextBox_CreateTime.Text; string roleName = DropDownList_Roles.SelectedItem.Text; //查询数据 DateTime bornTime = string.IsNullOrEmpty(time) ? DateTime.Now : Convert.ToDateTime(time); UserModel model = new UserModel(); model.Account = account; model.RoleName = roleName; model.CheckInTime = bornTime; //调用dal层分页查询代码 List <UserModel> result = dal.GetNewUserPageList(pageIndex, pageSize, model, out total); //把数据绑定到界面 repeater Repeater1.DataSource = result; Repeater1.DataBind(); //页码repeater2 //查询页码的数据 Repeater2.DataSource = PageDataHelper.GetPageList(total, pageSize); Repeater2.DataBind(); }