关于datagrid分页的问题,在线等。。。。
我新做了一个datagrid分页的程序,但是出现的问题是:
-------------------------
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0122: 不可访问“Test.WebForm2.DataGrid1_PageIndexChanged(object, System.Web.UI.WebControls.DataGridPageChangedEventArgs)”,因为它受保护级别限制
源错误:
行 11: <body MS_POSITIONING= "GridLayout ">
行 12: <form id= "Form1 " method= "post " runat= "server ">
行 13: <asp:DataGrid id= "DataGrid1 " style= "Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px " runat= "server " PageSize= "3 " AllowPaging= "True " OnPageIndexChanged= "DataGrid1_PageIndexChanged() ">
行 14: <PagerStyle NextPageText= "下一页 " PrevPageText= "上一页 "> </PagerStyle>
行 15: </asp:DataGrid>
源文件: http://localhost/Test/WebForm2.aspx 行: 13
----------------------------------
分页页面是WebForm2.aspx
代码如下:
<%@ Page language= "c# " Codebehind= "WebForm2.aspx.cs " AutoEventWireup= "false " Inherits= "Test.WebForm2 " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<HTML>
<HEAD>
<title> WebForm2 </title>
<meta name= "GENERATOR " Content= "Microsoft Visual Studio .NET 7.1 ">
<meta name= "CODE_LANGUAGE " Content= "C# ">
<meta name= "vs_defaultClientScript " content= "JavaScript ">
<meta name= "vs_targetSchema " content= "http://schemas.microsoft.com/intellisense/ie5 ">
</HEAD>
<body MS_POSITIONING= "GridLayout ">
<form id= "Form1 " method= "post " runat= "server ">
<asp:DataGrid id= "DataGrid1 " style= "Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px " runat= "server " PageSize= "3 " AllowPaging= "True " OnPageIndexChanged= "DataGrid1_PageIndexChanged() ">
<PagerStyle NextPageText= "下一页 " PrevPageText= "上一页 "> </PagerStyle>
</asp:DataGrid>
</form>
</body>
</HTML>
-----------------------
后台代码是:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Test
{
/// <summary>
/// WebForm2 的摘要说明。
/// </summary>
public class WebForm2 : Sy