我用程序绑定一个radiobuttonlist,比如总共有十项,我想将其中的两三项设为不可选,即将disabled设为false,我用程序 rdo.Items[0].Attribles["disabled"] = "false"; 不起作用
用JS写   Form1.rdo[0].disabled = false;  也不起作用,请问如何实现!

解决方案 »

  1.   

    enable是将所有都给去除掉了,我现在只想将某些可以选择,某些不能选择
      

  2.   

    testrdo.Items[0].Attribles["disabled"] = "fdisabled"; 
    rdo.Items[0].Enable = false;
    or Form1.rdo[0].disabled = true;这里正好是相反的 
      

  3.   

    rdo.Items[0].Attribles["disabled"] = "fdisabled"; 
    rdo.Items[0].Enable = false;
    or Form1.rdo[0].disabled = true;这里正好是相反的 
    -------------好像是
      

  4.   

    <%@ 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
    }
    }
      

  5.   

    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;
    }}
    }