Ani*_*hew 5 c# asp.net session-variables
我需要连接3个会话值Session ["First Name"],Session ["Middle Name"],Session ["Last Name"],其间有空格.
我尝试了以下方法:
Labelname.Text = String.Concat(this.Session["First Name"],"", this.Session["Middle Name"],"", this.Session["Last Name"]);
Run Code Online (Sandbox Code Playgroud)
但我得到的结果为:firstnamemiddlenamelastname
用。。。来代替 ” ”。
Labelname.Text = String.Concat(this.Session["First Name"]," ", this.Session["Middle Name"]," ", this.Session["Last Name"]);
Run Code Online (Sandbox Code Playgroud)
另一种方式:
Labelname.Text = this.Session["First Name"].ToString()+" "+ this.Session["Middle Name"].ToString()+" "this.Session["Last Name"]).ToString();
Run Code Online (Sandbox Code Playgroud)
希望它会有所帮助!
| 归档时间: |
|
| 查看次数: |
842 次 |
| 最近记录: |