触发TextBox_TextChanged(object sender,EventArgs e)事件时如何更改文本框的TextMode属性 [英] How to change TextMode property of a textbox when TextBox_TextChanged(object sender, EventArgs e) event fired

查看:352
本文介绍了触发TextBox_TextChanged(object sender,EventArgs e)事件时如何更改文本框的TextMode属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个TextBox和一个标签. TextBox的TextMode属性是密码.现在,当我将标签从密码单击为单行时,我想更改该TextBox TextMode属性.谁能帮我解决这个问题.
提前谢谢.


There is a TextBox and a label. TextBox TextMode property is password. Now i want to change that TextBox TextMode property when label is clicked from password to single line. Can anyone help me to solve this.
Thanks in advance.


protected void TextBox_TextChanged(object sender, EventArgs e)
    {
        label.Visible = true;
        label.Text = "show/hide"
    }
;

推荐答案


您可以使用另一个文本框在其中显示密码框的值.最初将文本框放在passwordBox下方,并且visible = hidden.
您的密码箱的onblur事件,隐藏密码箱并显示具有密码箱init值的可见文本框.


Hi,
you may use another textbox to show password box value into it. intially place the text box beneath your passwordBox and visible = hidden.
onblur event of your passwordbox, hide password box and display visible textbox with having value of passwordbox init.
i.e

<form id="form1" runat="server">
    <div>
        <asp:textbox textmode="Password" id="txtPass" runat="server" onblur="ShowPasswordEntered()" xmlns:asp="#unknown" />
    </div>
    </form>





<script type="text/javascript">
    function ShowPasswordEntered() {
        var passString = document.getElementById("txtPass").value;
        alert(passString);
    }
</script>


您说:但它从服务器端得到响应:"

您是否实际上已经使用适当的工具检查了服务器端的响应?该响应是什么样的:它是否提供任何线索,错误消息?您是否有可能说您没有从服务器获得响应?

如果出于某些有机"原因,您不应该在运行时在ASP.NET中更改TextBox上的TextMode属性,请考虑:有两个具有相同大小和位置的TextBox,其中一个设置为Textmode"Password", '设置为TextMode的"SingleLine"模式,然后根据需要切换z顺序?
You say: "but it get response from the server side:"

Have you actually examined the server-side response with an appropriate tool ? What does that response look like: does it give you any clue, any error message ? Is it possible you meant to say you are not getting a response from the server ?

If there is some ''organic'' reason you should not change the TextMode property on a TextBox at run-time in ASP.NET, then consider: have two TextBoxes with identical size and location, one set to Textmode ''Password,'' one set to TextMode ''SingleLine'' mode, and then just switch the z-order as necessary ?


这篇关于触发TextBox_TextChanged(object sender,EventArgs e)事件时如何更改文本框的TextMode属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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