http://www.cnblogs.com/yungboy/archive/2009/08/26/1554559.html

raddiobuttonlist解析出的HTML代码如下:
<table id="radsBusinessType" border="0">
 <tr>
  <td><input id="radsBusinessType_0" type="radio" name="radsBusinessType" value="0" checked="checked" /><label for="radsBusinessType_0"><font color="black">变更</font></label></td><td><span disabled="disabled"><input id="radsBusinessType_1" type="radio" name="radsBusinessType" value="1" disabled="disabled" /><label for="radsBusinessType_1"><font color="black">申请</font></label></span></td>
 </tr>
</table>
CheckBoxlist解析出的HTML代码如下:
<table id="chksAssignContent" border="0">
 <tr>
  <td><span disabled="disabled"><input id="chksAssignContent_0" type="checkbox" name="chksAssignContent$0" checked="checked" disabled="disabled" /><label for="chksAssignContent_0"><font color="black">申请AD帐号</font></label></span></td><td><span disabled="disabled"><input id="chksAssignContent_3" type="checkbox" name="chksAssignContent$3" checked="checked" disabled="disabled" /><label for="chksAssignContent_3"><font color="black">申请ERP帐号</font></label></span></td><td><span disabled="disabled"><input id="chksAssignContent_5" type="checkbox" name="chksAssignContent$5" disabled="disabled" /><label for="chksAssignContent_5"><font color="black">申请数字证书</font></label></span></td>
 </tr><tr>
  <td><span disabled="disabled"><input id="chksAssignContent_1" type="checkbox" name="chksAssignContent$1" disabled="disabled" /><label for="chksAssignContent_1"><font color="black">申请公司邮箱</font></label></span></td><td><span disabled="disabled"><input id="chksAssignContent_4" type="checkbox" name="chksAssignContent$4" disabled="disabled" /><label for="chksAssignContent_4"><font color="black">申请标准ERP岗位权限</font></label></span></td><td><span disabled="disabled"><input id="chksAssignContent_6" type="checkbox" name="chksAssignContent$6" disabled="disabled" /><label for="chksAssignContent_6"><font color="black">ERP岗位权限变更</font></label></span></td>
 </tr><tr>
  <td><span disabled="disabled"><input id="chksAssignContent_2" type="checkbox" name="chksAssignContent$2" disabled="disabled" /><label for="chksAssignContent_2"><font color="black">申请ERP额外权限</font></label></span></td><td></td><td></td>
 </tr>
</table>
处理方法如下:
1.HTML页面调用:
<script src="http://www.cnblogs.com/JavaScript/ResetPage.js" type="text/javascript"></script>
<body οnlοad="DeeperColorForRadioAndCheck()">
2.cs文件调用:

        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (!radsBusinessType.Enabled)
            {
                radsBusinessType.Enabled = true;
                Common.SetRaddionbuttonlistForeColor(radsBusinessType.Items);
            }
            if (!chksAssignContent.Enabled)
            {
                chksAssignContent.Enabled = true;

                Common.SetCheckBoxlistForeColor(chksAssignContent.Items);
            }
        }


公共方法:

        public static void SetRaddionbuttonlistForeColor(ListItemCollection items)
        {
           
            if (items.Count >1)
            {
                foreach (ListItem item in items)
                {
                    if (!item.Selected)
                    {
                        item.Enabled = false;
                    }

                    item.Text = "<font color=/"black/">" + item.Text + "</font>";

                }
            }
        }

        public static void SetCheckBoxlistForeColor(ListItemCollection items)
        {

            if (items.Count > 1)
            {
                foreach (ListItem item in items)
                {
                    item.Enabled = false;
                    item.Text = "<font color=/"black/">" + item.Text + "</font>";

                }
            }
        }


ResetPage.js文件:
//置raddionbutton
function DeeperColorForRadio() {
    var InputTotal = document.all.tags("INPUT").length;
    for (i = 0; i < InputTotal; i++) {
        if (document.all.tags("INPUT")[i].type == "radio" && document.all.tags("INPUT")[i].disabled == true) {

            document.all.tags("INPUT")[i].parentElement.disabled = false;
        }
    }
}
//checkbox
function DeeperColorForCheckBox() {
    var InputTotal = document.all.tags("INPUT").length;
    for (i = 0; i < InputTotal; i++) {
        if (document.all.tags("INPUT")[i].type == "checkbox" && document.all.tags("INPUT")[i].disabled == true) {

            document.all.tags("INPUT")[i].parentElement.disabled = false;
        }
    }
}
//
function DeeperColorForRadioAndCheck() {
    DeeperColorForRadio();
    DeeperColorForCheckBox();
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值