private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
DataSet ds=new DataSet();
BusinessLayer.Userbox Userbox=new BusinessLayer.Userbox();
ds=Userbox.GetUserBoxDetailByBoxStat(int.Parse(DropDownList1.SelectedValue));
UserboxGrid.DataSource=ds.Tables[0].DefaultView;
UserboxGrid.DataBind();
}
代码如上所表示

解决方案 »

  1.   

    DropDownList1的autoPostBack属性要设置为True,并且别忘了事件委托:
    #region Web 窗体设计器生成的代码
    override protected void OnInit(EventArgs e)
    {
    //
    // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
    //
    InitializeComponent();
    base.OnInit(e);
    }

    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {    
                this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
                this.Load += new System.EventHandler(this.Page_Load);        }
    #endregion
      

  2.   

    DropDownList1的autoPostBack属性要设置为True,要设哦,我也是忘记好几次的说,呵呵
      

  3.   

    是 我也来晚了 将AutoPostBack属性设置为True
      

  4.   

    将AutoPostBack属性设置为True
      

  5.   

    如果已经将AutoPostBack设成了true,还是不可以的话,就是.NET 2003的一个Bug,有的时候它并不能自动加载事件委托。手动添加即可!
    this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
      

  6.   

    检查一下Page_load实践的代码是不是有if(!IsPostBack)的判定,如果没有的话,这里的代码如果包含了DropDownList处理的内容的话,你DropDownList_SeletedIndexChanged就肯定得不到预期的结果