J
Jeff
hi
asp.net 3.5
I have a gridview on my webpage, which have paging enabled, and pagesize is
25.
the problem is that gridview doesn't show the links to go to next/previous
page. I suppose this have to do with setting the totalrecords correctly.
There are 480 users in the database, so it should atleast give 480/25 pages,
but none are displpayed
GridView:
<asp:GridView ID="gvwUsers" runat="server" Width="100%"
AlternatingRowStyle-BackColor="#FFFBD6" AllowSorting="true"
ShowHeader="true"
AutoGenerateColumns="false" AllowPaging="true" PageSize="25"
OnSorting="gvwUsers_Sorting"
OnRowDeleting="gvwUsers_RowDeleting" OnRowCreated="gvwUsers_RowCreated"
OnPageIndexChanging="gvwUsers_PageIndexChanging"
DataKeyNames="UserName">
<Columns>
Code that fills the GridView with data:
private void BindUsers(bool reloadAllUsers, int pageindex, int pagesize)
{
int totalRecords;
if (reloadAllUsers)
allUsers = Membership.GetAllUsers();
MembershipUserCollection users = null;
string searchText = "";
if (!string.IsNullOrEmpty(gvwUsers.Attributes["SearchText"]))
searchText = gvwUsers.Attributes["SearchText"];
bool searchByEmail = false;
Debug.WriteLine(gvwUsers.Attributes["SearchByEmail"].ToString());
if (!string.IsNullOrEmpty(gvwUsers.Attributes["SearchByEmail"]))
searchByEmail =
bool.Parse(gvwUsers.Attributes["SearchByEmail"]);
if (searchText.Length > 0)
{
if (searchByEmail)
users = Membership.FindUsersByEmail(searchText, pageindex,
pagesize, out totalRecords);
else
users = Membership.FindUsersByName(searchText, pageindex,
pagesize, out totalRecords);
}
else { users = allUsers; }
}
any ideas?
asp.net 3.5
I have a gridview on my webpage, which have paging enabled, and pagesize is
25.
the problem is that gridview doesn't show the links to go to next/previous
page. I suppose this have to do with setting the totalrecords correctly.
There are 480 users in the database, so it should atleast give 480/25 pages,
but none are displpayed
GridView:
<asp:GridView ID="gvwUsers" runat="server" Width="100%"
AlternatingRowStyle-BackColor="#FFFBD6" AllowSorting="true"
ShowHeader="true"
AutoGenerateColumns="false" AllowPaging="true" PageSize="25"
OnSorting="gvwUsers_Sorting"
OnRowDeleting="gvwUsers_RowDeleting" OnRowCreated="gvwUsers_RowCreated"
OnPageIndexChanging="gvwUsers_PageIndexChanging"
DataKeyNames="UserName">
<Columns>
Code that fills the GridView with data:
private void BindUsers(bool reloadAllUsers, int pageindex, int pagesize)
{
int totalRecords;
if (reloadAllUsers)
allUsers = Membership.GetAllUsers();
MembershipUserCollection users = null;
string searchText = "";
if (!string.IsNullOrEmpty(gvwUsers.Attributes["SearchText"]))
searchText = gvwUsers.Attributes["SearchText"];
bool searchByEmail = false;
Debug.WriteLine(gvwUsers.Attributes["SearchByEmail"].ToString());
if (!string.IsNullOrEmpty(gvwUsers.Attributes["SearchByEmail"]))
searchByEmail =
bool.Parse(gvwUsers.Attributes["SearchByEmail"]);
if (searchText.Length > 0)
{
if (searchByEmail)
users = Membership.FindUsersByEmail(searchText, pageindex,
pagesize, out totalRecords);
else
users = Membership.FindUsersByName(searchText, pageindex,
pagesize, out totalRecords);
}
else { users = allUsers; }
}
any ideas?