EVAL在锚标记的href [英] eval in anchor tag href
本文介绍了EVAL在锚标记的href的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想实现是使用一个eval在我的锚标记的href参数。锚嵌套的中继器,为什么我不能用code后面来实现这里面。
我已经尝试了一些事情没有任何运气。
< A HREF =HTTP:// MyWebsite / ActiveUsers ID = InsertEvalHere><%#的eval(姓名)%>< / A>
以下code以下是我试图做:
< A HREF =<%的http:// MyWebsite / ActiveUsers ID =+的DataBinder.Eval(的Container.DataItem(ID))%GT; ><%#的eval(姓名)%>< / A>&所述; A HREF =&下;%的http:// MyWebsite / ActiveUsers ID =+评估和演示(ID)%>中与GT;&下;%#评估和演示(姓名)%>&下; / A>&所述; A HREF =HTTP:// MyWebsite / ActiveUsers ID =&下;%的DataBinder.Eval(的Container.DataItem(ID))%>中与GT;&下;%#评估和演示(姓名)%&GT ;&所述; / A>&所述; A HREF =HTTP:// MyWebsite / ActiveUsers ID = LT;%#评估和演示(ID)%>中与GT;&下;%#评估和演示(姓名)%>&下; / A>
以上都不似乎是正确的,因为我不断收到此错误 - 标签的格式不正确
我应该如何处理呢?
解决方案
< A HREF =<%#的String.Format(HTTP:// MyWebsite / ActiveUsers ID? = {0}的eval(ID))%GT;>
What I am trying to achieve is to use an Eval as parameter in my anchor tag's href. The anchor is nested inside a repeater, why I cannot use the code behind to achieve this.
I have tried a few things without any luck.
<a href="http://MyWebsite/ActiveUsers?ID=InsertEvalHere"><%# Eval("Name")%></a>
The following code below is what I have tried to do:
<a href="<% "http://MyWebsite/ActiveUsers?ID=" + DataBinder.Eval(Container.DataItem("ID"))%>"><%# Eval("Name")%></a>
<a href="<% "http://MyWebsite/ActiveUsers?ID=" + Eval("ID")%>"><%# Eval("Name")%></a>
<a href="http://MyWebsite/ActiveUsers?ID=<% DataBinder.Eval(Container.DataItem("ID"))%>"><%# Eval("Name")%></a>
<a href="http://MyWebsite/ActiveUsers?ID=<%# Eval("ID")%>"><%# Eval("Name")%></a>
None of the above seemed to be right, as I keep getting this error - The tag is not well formed.
How should I handle this?
解决方案
<a href="<%# String.Format("http://MyWebsite/ActiveUsers?ID={0}", Eval("ID")) %>">
这篇关于EVAL在锚标记的href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文