在C#.NET中,如果设定了自定义绑定一个表中两列,怎样实现分页 在Datagrid中属性中我设置了绑定列,取消了运行时创建列,这样实现分页时,只会显示第一页,后面页不会显示。这是为什么?怎样才能正常显示?请版主帮忙?急呀!!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 datagrid自带分页http://singlepine.cnblogs.com/articles/266538.html<asp:datagrid id="DataGrid1" runat="server" AllowSorting="True" AutoGenerateColumns="False" PageSize="5" AllowPaging="True"> <Columns> <asp:TemplateColumn HeaderText="序号"> <HeaderStyle Width="10px"></HeaderStyle> <ItemTemplate> <INPUT id=radio onclick=fun_option(this) type=radio value='<%# DataBinder.Eval(Container.DataItem,"UserID") %>' name=radio> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:TemplateColumn> <asp:TemplateColumn HeaderText="序号"> <HeaderStyle Width="10px"></HeaderStyle> <FooterTemplate> </FooterTemplate> </asp:TemplateColumn> </Columns> <PagerStyle NextPageText="下一页" PrevPageText="上一页" HorizontalAlign="Right" ForeColor="DarkSlateBlue" BackColor="PaleGoldenrod" Mode="NumericPages"></PagerStyle></asp:datagrid>private void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e){ this.DataGrid1.CurrentPageIndex=e.NewPageIndex; DataBind();}自定义分页http://singlepine.cnblogs.com/articles/281425.html 多谢小山哥以后还请多指点小山哥有没有QQ或Email以后如果有急事,好直接与你联系。 我的分页老是报告错误请小山哥看一下:“/Graduate”应用程序中的服务器错误。--------------------------------------------------------------------------------当 AllowPaging 设置为真并且选定的数据源不实现 ICollection 时,AllowCustomPaging 必须为真,并且 ID 为 DataGrid1 的 DataGrid 必须设置 VirtualItemCount。 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Web.HttpException: 当 AllowPaging 设置为真并且选定的数据源不实现 ICollection 时,AllowCustomPaging 必须为真,并且 ID 为 DataGrid1 的 DataGrid 必须设置 VirtualItemCount。源错误: 行 45: cmd.CommandText="Select * from elResInfo where resID='"+elResID+"'";行 46: this.DataGrid1.DataSource=cmd.ExecuteReader();行 47: this.DataGrid1.DataBind();行 48: }行 49: 源文件: d:\wwwroot\graduate\mycontrols\elresource.ascx.cs 行: 47 堆栈跟踪: [HttpException (0x80004005): 当 AllowPaging 设置为真并且选定的数据源不实现 ICollection 时,AllowCustomPaging 必须为真,并且 ID 为 DataGrid1 的 DataGrid 必须设置 VirtualItemCount。] System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) System.Web.UI.WebControls.BaseDataList.DataBind() Graduate.MyControls.elResource.FillData() in d:\wwwroot\graduate\mycontrols\elresource.ascx.cs:47 Graduate.MyControls.elResource.Page_Load(Object sender, EventArgs e) in d:\wwwroot\graduate\mycontrols\elresource.ascx.cs:29 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Control.LoadRecursive() System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain() --------------------------------------------------------------------------------版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573 求助帖,项目合并后遇到的问题 jquery gridview更新数据问题 menuStrip控件的ShortcutKeys属性可以不加功能键吗? 新手求助引用问题。。。。。。。 推荐:IntelliGrid表格控件(Web Grid)V1.0 For Asp.Net2.0,3.5 "本地化"到底是什么意思啊? C# winform 获取局域网的所有IP问题 关于c#动态调用非托管DLL的内存释放问题 winForm1里datagirdview增删改 关于寸储过程 有关File Field 这个的问题 这个我不知道怎么做才好 高手进来看看~~~~
http://singlepine.cnblogs.com/articles/266538.html<asp:datagrid id="DataGrid1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
PageSize="5" AllowPaging="True">
<Columns>
<asp:TemplateColumn HeaderText="序号">
<HeaderStyle Width="10px"></HeaderStyle>
<ItemTemplate>
<INPUT id=radio onclick=fun_option(this) type=radio value='<%# DataBinder.Eval(Container.DataItem,"UserID") %>' name=radio>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="序号">
<HeaderStyle Width="10px"></HeaderStyle>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle NextPageText="下一页" PrevPageText="上一页" HorizontalAlign="Right" ForeColor="DarkSlateBlue"
BackColor="PaleGoldenrod" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
private void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
{
this.DataGrid1.CurrentPageIndex=e.NewPageIndex;
DataBind();
}自定义分页
http://singlepine.cnblogs.com/articles/281425.html
以后还请多指点
小山哥有没有QQ或Email以后如果有急事,好直接与你联系。
--------------------------------------------------------------------------------当 AllowPaging 设置为真并且选定的数据源不实现 ICollection 时,AllowCustomPaging 必须为真,并且 ID 为 DataGrid1 的 DataGrid 必须设置 VirtualItemCount。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Web.HttpException: 当 AllowPaging 设置为真并且选定的数据源不实现 ICollection 时,AllowCustomPaging 必须为真,并且 ID 为 DataGrid1 的 DataGrid 必须设置 VirtualItemCount。源错误:
行 45: cmd.CommandText="Select * from elResInfo where resID='"+elResID+"'";
行 46: this.DataGrid1.DataSource=cmd.ExecuteReader();
行 47: this.DataGrid1.DataBind();
行 48: }
行 49:
源文件: d:\wwwroot\graduate\mycontrols\elresource.ascx.cs 行: 47 堆栈跟踪:
[HttpException (0x80004005): 当 AllowPaging 设置为真并且选定的数据源不实现 ICollection 时,AllowCustomPaging 必须为真,并且 ID 为 DataGrid1 的 DataGrid 必须设置 VirtualItemCount。]
System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource)
System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e)
System.Web.UI.WebControls.BaseDataList.DataBind()
Graduate.MyControls.elResource.FillData() in d:\wwwroot\graduate\mycontrols\elresource.ascx.cs:47
Graduate.MyControls.elResource.Page_Load(Object sender, EventArgs e) in d:\wwwroot\graduate\mycontrols\elresource.ascx.cs:29
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573