问题描述
if(Request.QueryString [SelectValue]。ToString()==Cache&& Eval(LOADIND)。ToString()。Trim()==EF)
{%>
< a href =../ Home / AddMaterialDraft.aspx?Spirid =<%#Eval(ID)%>& project = <%#Eval(NAME)%>>
< img src =../ Images / change.pngstyle =height:30px; width:30px />< / a>
<%}%>
以上代码用于我的aspx页面。第一个条件值来自会话所以没有问题,但第二个条件是if语句中的数据表的值。现在我运行我的代码错误发生:
数据绑定方法,如Eval(),XPath ()和Bind()只能在数据绑定控件的上下文中使用。
我尝试过:
如何修复this.the if语句在转发器内。
if (Request.QueryString["SelectValue"].ToString() == "Cache" && Eval("LOADIND").ToString().Trim() == "EF")
{ %>
<a href="../Home/AddMaterialDraft.aspx?Spirid=<%# Eval("ID") %>&project= <%# Eval("NAME") %>">
<img src="../Images/change.png" style="height: 30px; width: 30px" /></a>
<% } %>
Above code is used in my aspx page. first condition value coming from session so no problem is occured but the second condition is value from datatable in if statement.now i run my code below error is occur :
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
What I have tried:
How to fix this.the if statement is inside the repeater.
推荐答案
这篇关于如何将eval值传递给aspx页面中的if语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!