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# 代码 :
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.
查询应返回超过两行( 当我使用中继器时会发生, 但我无法在中继器中进行拨号 ) 。