我在asp.net中使用c#创建了一个表单,其中一个网格视图和数据显示在这个工作正常但我也在表单上插入删除按钮当我点击插入按钮页面刷新并且网格视图无法看到如何解决它并防止隐藏网格
<table style ="margin-left:50px;">
<tr>
<td style ="width:10px;">
<asp:Button UseSubmitBehavior="true" ID="bttnadd" runat="server" Text="Add" style ="width:60px; background-color:azure" OnClick="bttnadd_Click" CommandName="bttnadd" OnClientClick ="showgrid()"/> </td>
<td colspan ="2;">
<asp:Button ID="bttndelete" runat="server" Text="Delete" style ="width:60px;background-color:azure" /> </td >
<td colspan ="0;">
<asp:Button ID="Bttnupdate" runat="server" Text="update" style ="width:60px; background-color:azure" /> </td>
<td class="auto-style6">
<asp:Button ID="Bttnreset" runat="server" Text="Reset" style ="width:60px; background-color:azure" />
</td>
</tr>
</table>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="category_id" DataSourceID="SqlDataSource1"
HorizontalAlign="Right" PageSize="5"
EnablePersistedSelection="True" ViewStateMode="Enabled"
Width="1px" CellPadding="4" Font-Size="Medium"
ForeColor="#333333" GridLines="None"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged1">
<AlternatingRowStyle HorizontalAlign="Right" VerticalAlign="Top"
BackColor="White" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
<asp:BoundField DataField="category_id" HeaderText="category_id" InsertVisible="False" ReadOnly="True" SortExpression="category_id" />
<asp:BoundField DataField="category_name" HeaderText="category_name" SortExpression="category_name" />
<asp:BoundField DataField="category_description" HeaderText="category_description" SortExpression="category_description" />
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerSettings Mode="NextPreviousFirstLast" />
<PagerStyle HorizontalAlign="Center" BackColor="#FFCC66" ForeColor="#333333" />
<RowStyle HorizontalAlign="Right" BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#9966FF" Font-Bold="True" ForeColor="Navy" />
<SortedAscendingCellStyle BackColor="#FDF5AC" />
<SortedAscendingHeaderStyle BackColor="#4D0000" />
<SortedDescendingCellStyle BackColor="#FCF6C0" />
<SortedDescendingHeaderStyle BackColor="#820000" />
</asp:GridView>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="category_id" DataSourceID="SqlDataSource1"
HorizontalAlign="Right" PageSize="5"
EnablePersistedSelection="True" ViewStateMode="Enabled"
Width="1px" CellPadding="4" Font-Size="Medium"
ForeColor="#333333" GridLines="None"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged1">
<AlternatingRowStyle HorizontalAlign="Right" VerticalAlign="Top"
BackColor="White" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
<asp:BoundField DataField="category_id" HeaderText="category_id" InsertVisible="False" ReadOnly="True" SortExpression="category_id" />
<asp:BoundField DataField="category_name" HeaderText="category_name" SortExpression="category_name" />
<asp:BoundField DataField="category_description" HeaderText="category_description" SortExpression="category_description" />
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerSettings Mode="NextPreviousFirstLast" />
<PagerStyle HorizontalAlign="Center" BackColor="#FFCC66" ForeColor="#333333" />
<RowStyle HorizontalAlign="Right" BackColor="#FFFBD6"
ForeColor="#333333" />
<SelectedRowStyle BackColor="#9966FF" Font-Bold="True"
ForeColor="Navy" />
<SortedAscendingCellStyle BackColor="#FDF5AC" />
<SortedAscendingHeaderStyle BackColor="#4D0000" />
<SortedDescendingCellStyle BackColor="#FCF6C0" />
<SortedDescendingHeaderStyle BackColor="#820000" />
</asp:GridView>
`