通过jQuery的禁用所有的页面控件 [英] Disabling all the Page Control through jQuery

查看:540
本文介绍了通过jQuery的禁用所有的页面控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作asp.net和C#。

I am working on asp.net and c#.

我使用大量的ASP和HTML控件的页面上,并在某些情况下,所有的控制被禁用。 一些使用的控制是:

I am using lots of ASP and HTML controls on the page and in some cases all the controls gets disabled. Some of the used Controls are:

RadioButton
RadioButtonList
CheckBox
CheckBoxList
TextBox
DropDownList
Button
etc...

我需要一个简单的和短期的方法来禁用所有的控件时,我呼吁一定条件下这个jQuery的方法。 任何帮助吗?

I need a Simple and short method to disabled all the Controls when i call this jQuery method on some condition. Any Help?

在此先感谢...

推荐答案

严格来说,你不能在所有使用jQuery禁用任何服务器控件,该服务器控件,而呈现页面时在服务器上,当页面到达时只存在在浏览器只呈现code留在控制。

Strictly speaking you can't disable any server controls at all using jQuery, the server controls only exist while the page is rendered on the server, when the page arrives in the browser only the rendered code is left of the controls.

您必须找出什么HTML元素从控制渲染和禁用这些元素。例如:

You have to find out what html elements are rendered from the controls and disable those elements. For example:

$('input[type=submit], input[type=checkbox], select, input[type=text], textarea').attr('disabled','disabled');

请注意,一个控件可以呈现为依赖于它的属性不同的HTML元素。与文本模式= SINGLELINE一个文本框将呈现为输入类型=文本,同时与文本模式=多行文本框呈现为一个文本区域。

Note that a control can be rendered as different html elements depending on it's attributes. A TextBox with TextMode=SingleLine is rendered as an input type="text", while a TextBox with TextMode=MultiLine is rendered as a textarea.

这篇关于通过jQuery的禁用所有的页面控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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