先判断SelectionList1.Selection是否为空在取值

解决方案 »

  1.   

    我遇到过这样的问题,
    首先就是看看SelectionList控件是否已经绑定数据,
    还有就是Label1是否已经在页面申明了
    protected System.Web.UI.WebControls.Label Label1;test!
      

  2.   

    SelectionList是什么呀?我第一次听说也。
      

  3.   

    private void Command1_Click(object sender, System.EventArgs e)
    {
    if (SelectionList1.Selection.Value!="") {
              Label1.Text=SelectionList1.Selection.Value; 
    this.ActiveForm=Form2;
              }
    }另外要看你的页面上有没有Label1控件?
      

  4.   

    未将对象引用设置到对象的实例
    --------------
    SelectionList1没定义或SelectionList1不是实例化对象
      

  5.   

    绑定的时候,有无分别指定TEXT和VALUE的对应字段?
      

  6.   

    加上这句吧
    protected System.Web.UI.WebControls.Label Label1;
      

  7.   

    各位,以上的方法我都试了,可还是不行。
    private void Command1_Click(object sender, System.EventArgs e)
    {
    if (SelectionList1.Selection.Value!="")   //连这行都过不去。
    {
              Label1.Text=SelectionList1.Selection.Value; 
    this.ActiveForm=Form2;
              }
    }
      

  8.   

    SelectionList那个大虾开发的控件