我想判断session中是否等于 字符a,该如何判断string tp=Session["select" + id].ToString() ;
if (tp == 'A') { this.RadioButton1.Checked = true; }

解决方案 »

  1.   

    你是什么需求?session储存单选框状态?
      

  2.   

    string tp=Session["select" + id].ToString() ;
    if (tp == 'A') { this.RadioButton1.Checked = true; }
    if (tp == 'B') { this.RadioButton2.Checked = true; }
    if (tp == 'C') { this.RadioButton3.Checked = true; }
    if (tp == 'D') { this.RadioButton4.Checked = true; }
      

  3.   

    断点查看string tp=Session["select" + id].ToString()  两边的值。特别是Session["select" + id].ToString()
      

  4.   

    显示无法调试 windows集成验证失败
      

  5.   

    System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 行 31:         tp = Session["select" + id].ToString(); 
      

  6.   

    string tp=Session["select" + id].ToString() ;
    if (tp == "A") { this.RadioButton1.Checked = true; }就这样判断,A写成字符串格式。
      

  7.   


    string curKey = "select" + id;
    if(Session[curKey != null)
    {
    string tp=Session[].ToString() ;
    if (tp == 'A') { this.RadioButton1.Checked = true; }
    }
      

  8.   


    string curKey = "select" + id;
    if(Session[curKey] != null)
    {
    string tp=Session[curKey].ToString() ;
    if (tp == 'A') { this.RadioButton1.Checked = true; }
    }
      

  9.   

    to  11楼
    编译器错误消息: CS0019: 运算符“==”无法应用于“string”和“char”类型的操作数
      

  10.   

    if (tp == "A") { this.RadioButton1.Checked = true; }
    if (tp == "B") { this.RadioButton2.Checked = true; }
    if (tp == "C") { this.RadioButton3.Checked = true; }
    if (tp == "D") { this.RadioButton4.Checked = true; }你真的遇到一下开一帖
    请自己认真思考一下 自己解决一下问题学会学习是非常重要的
      

  11.   


    if(tp=="A")
    用双引号,不要用单引号
      

  12.   

    string a=session["select"].tostring();
    string aa=合并a+id然后判断呗
      

  13.   

    if(Session["select" + id] !=null)
    {string tp=Session["select" + id].ToString() ;
    if (tp == 'A') { this.RadioButton1.Checked = true; }
    }