当按钮可见设置为false时,如何使用按钮 [英] how do I use The button while the button visible is set to false

查看:152
本文介绍了当按钮可见设置为false时,如何使用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将按钮的可见性设置为false时click事件不起作用

asp code

when I set the visible of The button to false The click event does not work
asp code

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



代码背后


code behind

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



当我按下浏览器中的按钮位置它不会出现


and when I press on The button place in The browser It do't appear

推荐答案

不可见也意味着它的行为就像它不存在一样。所以你得到的只是正常的行为。
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.


这篇关于当按钮可见设置为false时,如何使用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆