我有一个gridview,当我选择一行时,会出现Gridview_SelectedIndexChanged中的代码。但是,我注意到当我刷新时,调试器仍然进入这个方法?因此,当我刷新或返回页面时,就像用户点击了他离开的行一样。这是我的.aspx gridview代码:
<asp:GridView ID="gridview1" CellPadding="8" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="testdb" onclick="RowCommand"
onselectedindexchanged="MsgInbox_SelectedIndexChanged" PageSize="25"
AllowSorting="True" OnRowCreated="Gridview_RowCreated"
OnRowDataBound = "MsgInbox_RowDataBound" DataKeyNames = "primaryKey"