如何将eval值传递给aspx页面中的if语句? [英] How to pass eval value to if statement in aspx page?

查看:202
本文介绍了如何将eval值传递给aspx页面中的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.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.

推荐答案

需要完整的转发器HTML。 ..好像你在错误的地方使用片段
need your complete HTML for repeater... seems like you are using snippets in wrong place


这篇关于如何将eval值传递给aspx页面中的if语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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