我有一个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"