我的要求是显示数据库中的所有国家,并且对于每个国家,我必须显示其各自的状态。
因此,为了显示我使用 DataList 的所有国家/地区。`DataLIst 的 OnItemDataBound 函数我已经绑定了 gridview 以显示其各自的状态。
现在,我想为数据列表中的那个内部网格视图提供分页。
我不知道如何处理数据列表中的 gridview 分页。
我将网格视图绑定为,
protected void dataListCountries_OnItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
HiddenField hdn = (HiddenField)e.Item.FindControl("hdnCountryID");
GridView grd = (GridView)e.Item.FindControl("grdDetails");
objCountries = new Countries();
lstCountries = objCountries.getallCountries();
grd.DataSource = lstCountries ;
grd.DataBind();
}
}
请你们中的任何人为我提供解决方案。提前致谢。