在 ASP.NET 中,如何在单击另一个按钮时更改 gridview itemtemplate 同一列中按钮的可见性?

In ASP.NET, how do I change the visibility of a button in the same column of a gridview itemtemplate when the other button is clicked?

我有以下网格视图:

<asp:GridView ID="gridOpenMECs" runat="server">
    <Columns>
        <ItemTemplate>
            <asp:ImageButton ID="btnShow" runat="server" ImageUrl="xxx.png"
                OnClick="btnShow_OnClick" />
            <asp:ImageButton ID="btnHidden" runat="server"
                ImageUrl="yyy.png" Visible="false" />
        </ItemTemplate>
    </Columns>
 </asp:GridView>

当 button1 的 onclick 服务器端事件被触发时,我想获得 button2 的句柄,以便我可以将其 Visible 属性更改为 True。

Protected Sub btnShow_OnClick(ByVal sender As Object, ByVal e As ImageClickEventArgs)
    Dim btn as ImageButton = CTYPE(sender, ImageButton) 'get the sending button handle
    '' what next to make btnHidden visible?
End Sub

我怎样才能做到这一点?谢谢。

抱歉,C# 讲...

GridViewRow whichrow = (GridViewRow)btn.NamingContainer;
ImageButton btnHidden = (ImageButton)whichrow.FindControl("btnHidden")