我收到以下错误。
CS1061: 'webform1_aspx' does not contain a definition for 'GridView1_SelectedIndexChanged' and no extension method 'GridView1_SelectedIndexChanged' accepting a first argument of type 'webform1_aspx' could be found (are you missing a using directive or an assembly reference?)
来源错误:
Line 17: </strong>
Line 18: </div>
Line 19: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
Line 20: <AlternatingRowStyle BackColor="White" />
Line 21: <Columns>
我对这些东西很新(C#和ASP.NET)。我很感激任何帮助。并且,是的,我在发布此处之前用Google搜索了解决方案......
答案 0 :(得分:1)
您需要在代码隐藏文件中定义名为“GridView1_SelectedIndexChanged”的事件处理程序,如标记中所指定。
void GridView1_SelectedIndexChanged(Object sender, EventArgs e)
{
...
}