从标签文本创建查询 [英] Create querysting from label text

查看:78
本文介绍了从标签文本创建查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



大多数c#查询字符串教程使用文本框根据输入的文本创建查询字符串,但是我可以在应用程序中创建标签文本的查询字符串而不是文本框我有标签显示UserID,我需要将此UserID存储到查询字符串中以将其传递到另一个页面,所以如果可能我们可以做到这一点?? !!

解决方案

正如Bill所说,它就像从标签中获取文本然后将其放入查询字符串一样简单:



 < span class =code-sdkkeyword> String  labelValue = label1.Text; 
字符串 queryString = yoururl.aspx? + Server.UrlEncode(labelValue);


  String  lblValue = lblUserID.Text; 
String quesryString = Home.aspx? uid =' + lblValue + ';


Hi
Most of c# query string tutorial using textbox to create a query string depending on text entered in it, But instead of text box can we create a query string of label text as in my application i have label show the UserID and i need to store this UserID into a query string to pass it to another page so if it possible how we can do that??!!

解决方案

As Bill said, it's as simple as getting the text from the label and then putting it into the querystring:

String labelValue = label1.Text;
String queryString = "yoururl.aspx?" + Server.UrlEncode(labelValue);


String lblValue=lblUserID.Text;
String quesryString="Home.aspx?uid='"+lblValue+"'";


这篇关于从标签文本创建查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆