我试过的如下,HTML代码是:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
RadioButton 在CS中写的如下:using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//RadioButton选取后改变Texbox的可用性
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.RadioButtonList1.SelectedValue == "Y")
{
this.TextBox1.Enabled = true;
}
else
{
this.TextBox1.Enabled = false;
this.TextBox1.BackColor = System.Drawing.Color.FromName("#E0E0E0");
}
}
}
你可以复制过去试试,如果还有其他要问的,可以直接mail给我,mr.vski@gmail.com