【发布时间】:2013-07-15 17:50:06
【问题描述】:
我的要求是显示数据库中的所有国家,对于每个国家,我必须显示其各自的状态。
因此,为了显示我使用 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();
}
}
请你们中的任何人为我提供解决方案。提前致谢。
【问题讨论】:
-
你可以使用 NamingContainer 属性来做到这一点
-
你能把你的网格绑定代码放在fiddle/这里,这样就容易回答了
-
@Gangadhar 我已经给出了我的网格绑定代码。一旦检查出来..