如何将两个变量绑定到LinkButton控件 [英] How to Bind Two Variables to LinkButton Control
本文介绍了如何将两个变量绑定到LinkButton控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有链接按钮,并想使用参数
动态设置相同的postbackurl属性
例如〜profile/home.aspx?param = 4"
为此,我有数据源包含两列
1)ID
2)重定向路径
现在我必须将这两个列的值连接起来以像上面给出的那样形成url
我正在尝试
PostBackUrl =''<%#Bind("RedirectPath")?param =" Eval("ID")%>''
但它不起作用
I have link button & want to set postbackurl property of the same dynamically with parameter
eg "~profile/home.aspx?param=4"
for this i have datasource contain two columns
1) ID
2) Redirect path
now i have to concatenate this two column value to form url like the give above
i m trying this
PostBackUrl=''<%# Bind("RedirectPath") "?param=" Eval("ID") %>''
but its not working
推荐答案
请使用双引号"而不是字符串"括起来,如果变量PostBackUrl是字符串以外的其他类型,则将其转换为字符串.
字符只能容纳一个字符,字符文字是单引号中的单个字符,即&",如果我们包含多个字符,则会产生错误字符文字中的字符太多"
谢谢,
Please enclose in double Quotes "" instead of character string '''' and convert it to string if variable PostBackUrl is another type other than string.
A char can hold a single character only, a character literal is a single character in single quote, i.e. ''&'' , if we enclose more than 1 character then it will generate error "too many characters in character literal"
Thanks,
您还可以做一件事,您可以在sql select查询中选择两列作为单列.
You can do one more things, u can select two column as a single column in sql select query.
SELECT (ColumnA + ColumnB) AS ColumnZ
FROM Table;
然后将其与单个控件绑定
and then bind it with single control
这篇关于如何将两个变量绑定到LinkButton控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文