且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当按钮可见设置为false时,如何使用按钮

更新时间:2023-01-31 21:19:11

不可见也意味着它的行为就像它不存在一样。所以你得到的只是正常的行为。
Not visible also means that it behaves as if it wasn't there. So it's just normal behaviour what you're getting.


只有当你点击按钮时才会执行click事件。如果按钮的可见属性为false,您将如何单击按钮以及如何执行该事件。



The click event gets executed only when you click the button. if the visible property of the button is false how will you click the button and how could the event be executed.

<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button"/>







protected void Button1_Click(object sender, EventArgs e)
        {
            Button1.Visible = false;
        }
    }





这是应该执行的。



this is what should be executed.