在一个eval中使用两个字段名称 [英] use two field names in one eval

查看:84
本文介绍了在一个eval中使用两个字段名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i知道如何使用带有一个参数的Eval函数

hey
i know how to use Eval function with one parameters

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID", "ShowPages/{0}") %>'></asp:HyperLink>





但现在我想使用带有两个参数的Eval Function。

这样的事情





but now i want use Eval Function with two parameters.
something like this

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID","Title", "ShowPages/{0}/{1}") %>'></asp:HyperLink>







我该怎么做?




how can i do that?

推荐答案

你的第一个exaple映射到< a href =http://msdn.microsoft.com/en-us/library/2d76z3ck.aspx> DataBinder.Eval [ ^ ],并且没有超载需要更多参数。



您可以尝试:

Your first exaple maps to DataBinder.Eval[^], and there isn''t an overload that takes more arguments.

You could try:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl=''<%# Eval("ID", "ShowPages/{0}/")+Eval("Title", "{0}") %>''></asp:HyperLink>





我猜以上应该可行,因为这个



I guess the above should work, since this

<asp:Label ID="Label1" runat="server"  Text=''<%# Request.Browser.Platform + "-" + Request.Browser.Browser %>'' />



效果很好,但我还没试过。

< br $>
最好的问候

Espen Harlinn


works pretty well, but I haven''t tried it.

Best regards
Espen Harlinn


或者这个

or this
<asp:HyperLink ID="HyperLink1" runat="server"

NavigateUrl='<%# String.Format("~/Show/Display_PostID.aspx?TopicID={0}&Subject={1}"  ,Eval("TopicID"),  Eval("Subject")) %>'

Target="_blank">
 <%# Fakhravary.Text.SubString(Eval("Subject").ToString  (), 0, 48)%>
</asp:HyperLink>


这篇关于在一个eval中使用两个字段名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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