如何在具有AJAX 3.0的ASP.NET 3.5中启用DataGrid控件的页面调度属性 [英] How to enable the paging property of a DataGrid control in ASP.NET 3.5 with AJAX 3.0

查看:75
本文介绍了如何在具有AJAX 3.0的ASP.NET 3.5中启用DataGrid控件的页面调度属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在具有AJAX 3.0的ASP.NET 3.5中启用DataGrid控件的页面属性?尝试执行此操作时出现以下错误:

How can I enable the paging property of a DataGrid control in ASP.NET 3.5 with AJAX 3.0? I am getting the following error when I try to do it:

The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.



有人可以帮我吗?



Can anyone help me out please?

推荐答案

您是在VB还是C#中执行此操作?如果您更具体,这会有所帮助.

好的,首先要做的事. datagrid和gridview是不同的控件.将gridview想象成类固醇的数据网格.

而且,这与ajax并没有任何关系.是的,gridview控件使用的是javascript,但您不必为此担心.

如果您使用的是gridview(我建议),那么它就这么简单.....

在vb

Are you doing this in VB or C#? It helps if you are more specific.

Ok first things first. The datagrid and the gridview are different controls. Imagine the gridview as a datagrid on steroids.

Also, this doesn''t really have anything to do with ajax. Yes the gridview control uses javascript but you don''t need to worry about that.

If it is a gridview you are using (which I recommend)then it''s as easy as this.....

In vb

Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs) _
Handles GridView1.PageIndexChanging
    GridView1.PageIndex = e.NewPageIndex
    ''Rebind the gridview to the datasource.
End Sub



在c#



In c#

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
    //Rebind the gridview to the datasource.
}



那应该做.

显然,在c#中,您必须将处理程序添加到gridview控件中.您可以通过单击属性"选项卡中的事件来执行此操作,也可以在设计器文件中手动更改它.

祝你好运.



That should do it.

Obviously in c# you will have to add the handler to your gridview control. You can either do this by clicking on the event in your properties tab or manually change it in your designer file.

Good luck.


这篇关于如何在具有AJAX 3.0的ASP.NET 3.5中启用DataGrid控件的页面调度属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆