我目前的程序是这样的有一个下拉列表他是受到两个RadioButton 控制的.当我第一次打开页面的时候当然可以会得到DropDownList 的数值. 当我点击让它隐藏的RadioButton之后.再点击显示 RadioButton ,这个时候 DropDownList 的数值就不能完全传获取出来.不知道这是为什么?
若能解答,重谢
------解决方案--------------------------------------------------------
- C# code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:RadioButton ID="RadioButton1" runat="server" AutoPostBack="True" OnCheckedChanged="RadioButton1_CheckedChanged" GroupName="1" /> <asp:RadioButton ID="RadioButton2" runat="server" AutoPostBack="True" OnCheckedChanged="RadioButton2_CheckedChanged" GroupName="1" /> <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList> </div> </form></body></html>cs 文件using System;using System.Web.UI;public partial class Default3 : Page{ protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DropDownList1.Items.Add("1"); DropDownList1.Items.Add("2"); } } protected void RadioButton1_CheckedChanged(object sender, EventArgs e) { DropDownList1.Visible = false; } protected void RadioButton2_CheckedChanged(object sender, EventArgs e) { DropDownList1.Visible = true; }}我试过,这样不会有问题的