Category_ListBox的数据绑定代码应该写在
if(!Page.IsPostback)
{
//数据绑定代码
}

解决方案 »

  1.   

    private void Button4_Click(object sender, System.EventArgs e)
    {
    string Category_Aoto_Id = this.Category_ListBox.SelectedValue.ToString();this.TextBox1.Text =  Category_Aoto_Id;
    }
    这可怎么写入 ispostback阿
      

  2.   

    你怎么给你的Category_ListBox初始选项的?
    直接写在aspx文件中?
      

  3.   

    public void Category_ListBox_DataSource(DataSet ds ,string Datatextfield ,string Datavaluefield)
    {
    this.Category_ListBox.DataSource = ds.Tables[0].DefaultView;
    this.Category_ListBox.DataTextField =Datatextfield;
    this.Category_ListBox.DataValueField =Datavaluefield;
    this.Category_ListBox.DataBind();
    }
    看怎么办啊。。我不能先初始化。。我实际上是做一个有管listbox的用户空间。。我得在别的aspx页中,,给给上边的方法传递参数才能榜定数据。。
      

  4.   

    你最终有调用Category_ListBox_DataSource(DataSet ds ,string Datatextfield ,string Datavaluefield)
    的地方,在那加入Category_ListBox的数据绑定代码应该写在
    if(!Page.IsPostback)
    {
    //数据绑定代码
    }