这是GridView
代码:错误的GridView CS1061
<asp:GridView ID="datagrid" runat="server" CssClass="mydatagrid" PagerStyle-CssClass="pager" HeaderStyle-CssClass="header" RowStyle-CssClass="rows" AllowPaging="True" OnPageIndexChanging="datagrid_PageIndexChanging">
</asp:GridView>
这是C#代码:
string str = "Data Source=(LocalDB)\\MSSQLLocalDB;";
str += "AttachDbFilename=|DataDirectory|DinoData.mdf;";
str += "Integrated Security= True";
SqlConnection c;
c = new SqlConnection(str);
DataTable dt = new DataTable();
String req = "SELECT * FROM [User]";
SqlDataAdapter da = new SqlDataAdapter(req, c);
da.Fill(dt);
datagrid.DataSource = dt;
datagrid.DataBind();
错误:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1061: 'ASP.manger_search_aspx' does not contain a definition for 'datagrid_PageIndexChanging' and no extension method 'datagrid_PageIndexChanging' accepting a first argument of type 'ASP.manger_search_aspx' could be found (are you missing a using directive or an assembly reference?)
那么你是否在代码中的任何地方声明了一个名为'datagrid_PageIndexChanging'的处理程序? –
不,我不这么认为 –