我做分页显示
jfbao 2004-02-26 05:00:14 编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0122: 不可访问“td.gocent.Page_Index(object, System.Web.UI.WebControls.DataGridPageChangedEventArgs)”,因为它受保护级别限制
源错误:
行 12: <form id="Form1"method="post"runat="server">
行 13: <FONT face="宋体"></FONT>
行 14: <asp:DataGrid id="DataGrid1"runat="server"
行 15: AllowPaging="True"
行 16: Width="528px"
private void Page_Index(object sender, DataGridPageChangedEventArgs e)
{
con.ConnectionString="server=localhost;database=tdse;uid=admin;pwd=123";
mycom="select * from khtable";
try
{
con.Open();
com.CommandText=mycom;
com.Connection=con;
SqlDataAdapter myapter=new SqlDataAdapter(mycom,con);
myapter.Fill(mydataset,"usertable");
DataGrid1.CurrentPageIndex=e.NewPageIndex;
DataGrid1.DataSource=mydataset.Tables["khtable"].DefaultView;
DataGrid1.DataBind();
}
catch(Exception ex)
{
Label1.Text=ex.Message;
}
finally
{
con.Close();
}
}