读书人

编译器异常信息: CS0123: “MyList_Pa

发布时间: 2011-12-26 23:09:58 作者: rapoo

编译器错误信息: CS0123: “MyList_Page”的重载均与委托“System.EventHandler”不匹配
<asp:GridView ID= "MyList " AllowPaging= "true " PageSize= "10 " OnPageIndexChanged= "MyList_Page " runat= "server " Width= "500 " GridLines= "None " CellPadding= "2 " CellSpacing= "1 " Font-Size= "8pt " Font-Names= "宋体 " AutoGenerateColumns= "false " EnableViewState= "false " DataKeyNames= "id " OnRowDeleted= "MyDataGrid_Delete ">
<Columns>
<asp:ButtonField ItemStyle-Width= "150px " HeaderText= " " DataTextField= "shijian " />
<asp:HyperLinkField ItemStyle-Width= "400px " HeaderText= " " DataNavigateUrlFields= "id " DataNavigateUrlFormatString= "update.aspx?id={0} " DataTextField= "biaoti " Target= "_blank " />
<asp:ButtonField ItemStyle-Width= "100px " Text= "删除 " CommandName= "Delete " />
</Columns>
</asp:GridView>

*******************************************************************************************************************************************
public void MyList_Page(object sender, GridViewPageEventArgs e)
{
MyList.PageIndex= e.NewPageIndex;
DataBind();
}

*****************************************************************************************************************************

运行时候有错误:

编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。

编译器错误信息: CS0123: “MyList_Page”的重载均与委托“System.EventHandler”不匹配

源错误:



行 25: <td style= "width:608; ">
行 26: <div style= "text-align: center ">


行 27: <asp:GridView ID= "MyList " AllowPaging= "true " PageSize= "10 " OnPageIndexChanged= "MyList_Page " runat= "server " Width= "500 " GridLines= "None " CellPadding= "2 " CellSpacing= "1 " Font-Size= "8pt " Font-Names= "宋体 " AutoGenerateColumns= "false " EnableViewState= "false " DataKeyNames= "id " OnRowDeleted= "MyDataGrid_Delete ">
行 28: <Columns>
行 29: <asp:ButtonField ItemStyle-Width= "150px " HeaderText= " " DataTextField= "shijian " />


源文件: h:\ASP.NET\WebSites\WebSite2\xinwen\update.aspx 行: 27



[解决办法]
void CustomersGridView_PageIndexChanged(Object sender, EventArgs e)
{
// Call a helper method to display the current page number
// when the user navigates to a different page.
DisplayCurrentPage();
}

[解决办法]
protected void GridView1_PageIndexChanged(object sender, EventArgs e) { }
[解决办法]
public void MyList_Page(object sender, GridViewPageEventArgs e)
改为:
public void MyList_Page(object sender, EventArgs e)
[解决办法]
如果你要用GridViewPageEventArgs 那是PageIndexChanged事件的参数

读书人网 >asp.net

热点推荐