1
Answer

How to Pass Eval value to if statement in aspx page?

Raja

Raja

7y
419
1
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.

How to fix this.the if statement is inside the repeater. 
Answers (1)