如何制作开关盒 [英] how to make switch case
本文介绍了如何制作开关盒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何制作切换案例,其中我必须将密码字段设为false。
i有位列,如果位为1,则密码字段必须隐藏,否则我将可见
我将怎么做?
how to make switch case in which i have to make password field false.
i have bit column which if bit is 1 then password field must hide otherwise it will me visible
how i will do that??
推荐答案
你已经发布了多个解决方案。
现在只是为了你的快速学习
http://csharp.net-informations.com/statements/csharp-switch-case.htm [ ^ ]
Already you got multiple solutions posted.
Now just for your quick learning
http://csharp.net-informations.com/statements/csharp-switch-case.htm[^]
使用Switch case,如果你只有一个条件..
试试这个
Its no use of using Switch case,if you r having only one condition..
try this
bool bit = false; // bit value from sql will be converted to bool
txtPassword.Visible = bit;
无论如何你的切换案例在这里。
anyhow your switch case here.
switch (bit)
{
case true:
txtPassword.Visible = true;
break;
case false:
txtPassword.Visible = true;
break;
default:
break;
}
取一个复选框n使其启用= false,autopostback = true,
添加其事件,单击复选框转到事件,双击选中。它将在页面的后端生成事件代码。
在此活动中,添加此代码。
take one check box n make it enabled = false, autopostback=true,
add its event, click on checkbox go to events, double click Checked. it will generate event code at backend of the page.
in this event, add this code.
if(checkbox.checked)
{
txtpwd.enabled = true;
}
else
{
txtpwd.enabled = false;
}
请知道它是否有效,
plz let know if its works,
这篇关于如何制作开关盒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文