private void GetUsers() { UsersOnlineLabel.Text = Membership.GetNumberOfUsersOnline().ToString(); RepeaterUser.DataSource = Membership.GetAllUsers(currentPage - 1, pageSize, out totalUsers); totalPages = ((totalUsers - 1) / pageSize) + 1; // Ensure that we do not navigate past the last page of users. if (currentPage > totalPages) { currentPage = totalPages; GetUsers(); return; } RepeaterUser.DataBind(); CurrentPageLabel.Text = currentPage.ToString(); TotalPagesLabel.Text = totalPages.ToString(); if (currentPage == totalPages) { NextButton.Visible = false; } else { NextButton.Visible = true; } if (currentPage == 1) { PreviousButton.Visible = false; } else { PreviousButton.Visible = true; } if (totalUsers <= 0) { NavigationPanel.Visible = false; } else { NavigationPanel.Visible = true; } }
protected void btTimKiemThat_Click(object sender, EventArgs e) { if (RadioButtonUserName.Checked) { if (txtTimKiem.Text != "") { RepeaterUser.DataSource = Membership.FindUsersByName(txtTimKiem.Text.ToLower().Trim(), currentPage - 1, pageSize, out totalUsers); totalPages = ((totalUsers - 1) / pageSize) + 1; // Ensure that we do not navigate past the last page of users. if (currentPage > totalPages) { currentPage = totalPages; GetUsers(); return; } RepeaterUser.DataBind(); CurrentPageLabel.Text = currentPage.ToString(); TotalPagesLabel.Text = totalPages.ToString(); if (currentPage == totalPages) { NextButton.Visible = false; } else { NextButton.Visible = true; } if (currentPage == 1) { PreviousButton.Visible = false; } else { PreviousButton.Visible = true; } if (totalUsers <= 0) { NavigationPanel.Visible = false; } else { NavigationPanel.Visible = true; } //RepeaterUser.DataSource = Membership.FindUsersByName(txtTimKiem.Text.ToLower().Trim()); //RepeaterUser.DataBind(); } } else if (RadioButtonEmail.Checked) { if (txtTimKiem.Text != "") { RepeaterUser.DataSource = Membership.FindUsersByEmail(txtTimKiem.Text.ToLower().Trim(), currentPage - 1, pageSize, out totalUsers); totalPages = ((totalUsers - 1) / pageSize) + 1; // Ensure that we do not navigate past the last page of users. if (currentPage > totalPages) { currentPage = totalPages; GetUsers(); return; } RepeaterUser.DataBind(); CurrentPageLabel.Text = currentPage.ToString(); TotalPagesLabel.Text = totalPages.ToString(); if (currentPage == totalPages) { NextButton.Visible = false; } else { NextButton.Visible = true; } if (currentPage == 1) { PreviousButton.Visible = false; } else { PreviousButton.Visible = true; } if (totalUsers <= 0) { NavigationPanel.Visible = false; } else { NavigationPanel.Visible = true; } } } else if (RadioButtonLastActivityDate.Checked) { txtTimKiem.Text = ""; if (txtTimKiem.Text != "") { RepeaterUser.FindControl(txtTimKiem.Text.ToLower().Trim()); RepeaterUser.DataBind(); } } }