单选按钮客户端验证 [英] Radio Button Client validation

查看:86
本文介绍了单选按钮客户端验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii.

在项目的主页中,我有一个ASPxPageControl和ASPxPopupControl.在ASPxPopUpControl中,我的表单由两个单选按钮,许多文本字段和组合框等组成.在ASPxPageControl中,有两个选项卡.

ASPxPopupControl的PopUpElement在第二个选项卡中.在PageLoad()上,我已配置为显示第一个选项卡.

我想根据用户对单选按钮的选择启用/禁用表单中的texbox.但是,启用AutoPostBack后,将刷新整个页面,默认选项卡将是第一个.要恢复该表单,我必须手动单击第二个选项卡,ASPxPopupControl会自动打开.

反正有解决办法吗?除了单选按钮之外,还有其他控件吗?(接受客户端脚本)

Hii.

In my project, in the main page, I''ve a ASPxPageControl and ASPxPopupControl. In the ASPxPopUpControl, I''ve a form consits of two radio buttons and so many text fields and combo boxes etc. In the ASPxPageControl, there are two tabs.

The PopUpElement of ASPxPopupControl is in the second tab. And on the PageLoad(), I''ve configured to display the first tab.

I want to enable/disable texbox in the form according to the user selection of the radio button. But, when AutoPostBack is enabled, the entire page is refreshed, and the default tab will be the first one. And to resume the form, i''ve to manually click the second tab and the ASPxPopupControl will open automatically.

Is there anyway to resolve this?? Is there any other control other than radio button to do this?(Which accepts client side scripting)

推荐答案

使用javascript手动启用/禁用文本框.

每个单选按钮都有一个可以处理的javascript事件,称为onChange




然后您的javascript函数将如下所示:


Use javascript to enable/disable the textbox manually.

Your radiobuttons each have a javascript event that can be handled called onChange




Then your javascript function will look like:


var enableText = false;
function setTextBox(enableText){
    //thus far we''re not using jQuery, but jQuery makes this easier
    var txtBox = document.getElementById(<%= txtBoxControl.ClientId %>);
    txtBox.disabled = enableText;
}




享受吧.




Enjoy.


这篇关于单选按钮客户端验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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