在运行时将组合框转换为文本框 [英] Converting a combobox into a textbox at runtime

查看:86
本文介绍了在运行时将组合框转换为文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个组合框,其中显示了一些现有成员的名称,他们可以从中选择其名称.
但是对于一个新用户,我有一个按钮(btnUser),单击它时,我想在焦点处显示一个空文本框来代替组合框.

这怎么可能?

谢谢
Amit

Hey everyone,

I have a combobox which shows names of some existing members from which they can select their name.
But for a new User I have a button(btnUser) and on its click I want to show an empty text box in focus in place of combobox.

How is this possible?

Thanks
Amit

推荐答案

您可以使用javascript&对于这个javascript来说是最好的.
示例:

< asp:LinkBut​​ton ID ="lbUploadOrThanks" runat ="server" OnClientClick ="return EnabledFalse()== true?true:false;"></asp:LinkBut​​ton>

< div id ="divComboBox">
//将您的组合框放在这里
</div>
< div id ="divTextBox" style ="display:none;">
//将您的文本框放在这里
</div>

Javascript:
var J = jQuery.noConflict();

函数EnabledFalse(){
J(#divTextBox").show();
J(#divComboBox").hide();
返回false;
}
You can use javascript & for this javascript is the best.
Example:

<asp:LinkButton ID="lbUploadOrThanks" runat="server" OnClientClick="return EnabledFalse()==true ? true : false;"></asp:LinkButton>

<div id="divComboBox">
//put here your combobox
</div>
<div id="divTextBox" style="display:none;">
//put here your textbox
</div>

Javascript:
var J = jQuery.noConflict();

function EnabledFalse() {
J("#divTextBox").show();
J("#divComboBox").hide();
return false;
}


只需在单击事件上设置Combobox.Visible = False和TextBox.Visible = True.
Just make the Combobox.Visible = False and TextBox.Visible = True on th click event.


这篇关于在运行时将组合框转换为文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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