如何将RadioButtonList中某几项的disabled设置为false! 我用程序绑定一个radiobuttonlist,比如总共有十项,我想将其中的两三项设为不可选,即将disabled设为false,我用程序 rdo.Items[0].Attribles["disabled"] = "false"; 不起作用用JS写 Form1.rdo[0].disabled = false; 也不起作用,请问如何实现! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 enable是将所有都给去除掉了,我现在只想将某些可以选择,某些不能选择 testrdo.Items[0].Attribles["disabled"] = "fdisabled"; rdo.Items[0].Enable = false;or Form1.rdo[0].disabled = true;这里正好是相反的 rdo.Items[0].Attribles["disabled"] = "fdisabled"; rdo.Items[0].Enable = false;or Form1.rdo[0].disabled = true;这里正好是相反的 -------------好像是 <%@ Page language="c#" Codebehind="WebForm4.aspx.cs" AutoEventWireup="false" Inherits="WebService.WebForm4" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML><HEAD><title>WebForm4</title><meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"><meta name="CODE_LANGUAGE" Content="C#"><meta name="vs_defaultClientScript" content="JavaScript"><meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"><script>function onload() {var radioButton = document.getElementsByTagName("input")for (var i=0;i<radioButton.length;i++) {if (radioButton[i].type == "radio") {if (radioButton[i].value=="ALFKI"){radioButton[i].disabled=true;}}}}</script></HEAD><body MS_POSITIONING="GridLayout" onload="onload()"><form id="Form1" method="post" runat="server"><FONT face="宋体"><asp:RadioButtonList id="RadioButtonList1" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 216px"runat="server" Height="56px" Width="520px"></asp:RadioButtonList></FONT></form></body></HTML>using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;namespace WebService{/// <summary>/// WebForm4 的摘要说明。/// </summary>public class WebForm4 : System.Web.UI.Page{protected System.Web.UI.WebControls.RadioButtonList RadioButtonList1;protected System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;protected System.Data.OleDb.OleDbConnection oleDbConnection1;protected WebService.DataSet1 dataSet11;private void Page_Load(object sender, System.EventArgs e){// 在此处放置用户代码以初始化页面this.oleDbDataAdapter1.Fill (this.dataSet11 .Customers);this.RadioButtonList1 .DataSource=this.dataSet11 .Customers ;this.RadioButtonList1.DataTextField="CustomerID";this.RadioButtonList1.DataValueField="CustomerID";this.RadioButtonList1 .DataBind();}#region Web 窗体设计器生成的代码override protected void OnInit(EventArgs e){//// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。//InitializeComponent();base.OnInit(e);}/// <summary>/// 设计器支持所需的方法 - 不要使用代码编辑器修改/// 此方法的内容。/// </summary>private void InitializeComponent(){this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();this.dataSet11 = new WebService.DataSet1();((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();//// oleDbDataAdapter1//this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {new System.Data.Common.DataTableMapping("Table", "Customers", new System.Data.Common.DataColumnMapping[] {new System.Data.Common.DataColumnMapping("CompanyName", "CompanyName"),new System.Data.Common.DataColumnMapping("CustomerID", "CustomerID")})});//// oleDbSelectCommand1//this.oleDbSelectCommand1.CommandText = "SELECT CompanyName, CustomerID FROM Customers";this.oleDbSelectCommand1.Connection = this.oleDbConnection1;//// oleDbConnection1//this.oleDbConnection1.ConnectionString = @"User ID=sa;Data Source=GW;Tag with column collation when possible=False;Initial Catalog=Northwind;Use Procedure for Prepare=1;Auto Translate=True;Persist Security Info=False;Provider=""SQLOLEDB.1"";Workstation ID=GW;Use Encryption for Data=False;Packet Size=4096";//// dataSet11//this.dataSet11.DataSetName = "DataSet1";this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");this.Load += new System.EventHandler(this.Page_Load);((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();}#endregion}} function onload() {var radioButton = document.getElementsByTagName("input")for (var i=0;i<radioButton.length;i++) {if (radioButton[i].type == "radio") {if (radioButton[i].value=="ALFKI") //注意这{radioButton[i].disabled=true;}}} JS中绑定的Boolean值不识别的问题 des加密的问题 【复杂问题】如何取得Body的高度 .net 继承类之间运行的顺序 关于网页之间传送参数的问题,帮帮我,Request.Query 高分再求!关于读取的问题! 如何用一个button调用子函数?急...再弄不出来,工作就没了,大家帮帮忙 asp.net2005 抽象工厂模式 为什么在BLL层报错“未将对象引用设置到对象的实例”在线等待!急。。 如何解决联动下拉框的回传服务器的问题 post参数太长,页面加载Page_Load无法执行 文件上传得不到文件,各位帮忙看看是什么原因 如何把SQL語句調用的數據用代碼將數據顯示在水晶報表里
rdo.Items[0].Enable = false;
or Form1.rdo[0].disabled = true;这里正好是相反的
rdo.Items[0].Enable = false;
or Form1.rdo[0].disabled = true;这里正好是相反的
-------------好像是
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm4</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script>
function onload() {var radioButton = document.getElementsByTagName("input")
for (var i=0;i<radioButton.length;i++) {
if (radioButton[i].type == "radio") {
if (radioButton[i].value=="ALFKI")
{
radioButton[i].disabled=true;
}}
}}</script>
</HEAD>
<body MS_POSITIONING="GridLayout" onload="onload()">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<asp:RadioButtonList id="RadioButtonList1" style="Z-INDEX: 101; LEFT: 40px; POSITION: absolute; TOP: 216px"
runat="server" Height="56px" Width="520px"></asp:RadioButtonList></FONT>
</form>
</body>
</HTML>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace WebService
{
/// <summary>
/// WebForm4 的摘要说明。
/// </summary>
public class WebForm4 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.RadioButtonList RadioButtonList1;
protected System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
protected System.Data.OleDb.OleDbConnection oleDbConnection1;
protected WebService.DataSet1 dataSet11;private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
this.oleDbDataAdapter1.Fill (this.dataSet11 .Customers);
this.RadioButtonList1 .DataSource=this.dataSet11 .Customers ;this.RadioButtonList1.DataTextField="CustomerID";
this.RadioButtonList1.DataValueField="CustomerID";
this.RadioButtonList1 .DataBind();
}#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();
this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
this.dataSet11 = new WebService.DataSet1();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
//
// oleDbDataAdapter1
//
this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;
this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Customers", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("CompanyName", "CompanyName"),
new System.Data.Common.DataColumnMapping("CustomerID", "CustomerID")})});
//
// oleDbSelectCommand1
//
this.oleDbSelectCommand1.CommandText = "SELECT CompanyName, CustomerID FROM Customers";
this.oleDbSelectCommand1.Connection = this.oleDbConnection1;
//
// oleDbConnection1
//
this.oleDbConnection1.ConnectionString = @"User ID=sa;Data Source=GW;Tag with column collation when possible=False;Initial Catalog=Northwind;Use Procedure for Prepare=1;Auto Translate=True;Persist Security Info=False;Provider=""SQLOLEDB.1"";Workstation ID=GW;Use Encryption for Data=False;Packet Size=4096";
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();}
#endregion
}
}
for (var i=0;i<radioButton.length;i++) {
if (radioButton[i].type == "radio") {
if (radioButton[i].value=="ALFKI") //注意这
{
radioButton[i].disabled=true;
}}
}