I am trying to do paging of data. Basically I am taking a data and want to show it on multi pages. But it is not working. I am using Asp.net and C# for coding. I am using mysql as database.
Code is as follows : ASP code
<asp:DataGrid runat="server" ID="RestData"
AllowPaging="True" PageSize="2"
OnPageIndexChanged="RestData_PageIndexChanged" AllowCustomPaging="True"
PagerStyle-Wrap="False">
<PagerStyle />
</asp:DataGrid>
C# code:
protected void Page_Load(object sender, EventArgs e)
{
BindData();
}
public void BindData()
{
RestData.DataSource = call.GetReader(Convert.ToInt32(AreaData.SelectedValue));
//GetReader is function which returns the data reader of mysql
RestData.DataBind();
}
protected void RestData_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
RestData.CurrentPageIndex = e.NewPageIndex;
BindData();
}
Output : It is displaying two rows(as i have given pagesize 2). But I am not able to see next page. The query should returns more than 2 rows(it does happen when i use repeater but i am not able to do paging in it.
Please provide some solution ( I was not able to solve my question with any other solution in this forum so i have created new one)
THANKS in ADVANCE.