Reputation: 2587
I pass some datarow fields multiple times in a few functions to get some result for my table, so i thought id put them in some int's make the code clean, but the below returns
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
and if i use <%# instead i get expected ")" (right bracket)
what do i need to use to make the below work?
Thanks
<%
C = Convert.ToInt32(Eval("Confidentiality"));
I = Convert.ToInt32(Eval("Integrity"));
A = Convert.ToInt32(Eval("Availability"));
T = Convert.ToInt32(Eval("Threat"));
V = Convert.ToInt32(Eval("Vulnerability"));
L = Convert.ToInt32(Eval("Likelihood"));
%>
<td class='<%# functions.colorscale(functions.Importance(C,I,A))%>'><%# functions.Importance(C,I,A) %></td>
<td class='<%# functions.colorscale(functions.Rank(C,I,A,T,V,L))%>'><%# functions.Rank(C,I,A,T,V,L) %></td>
<td class='<%# functions.colorscale(Eval("NewRank").ToString())%>'><%# Eval("NewRank") %></td>
Upvotes: 1
Views: 172
Reputation: 2587
i needed to put each var in its own <% now it works!
<%# C = Convert.ToInt32(Eval("Confidentiality")) %>
<%# I = Convert.ToInt32(Eval("Integrity")) %>
<%# A = Convert.ToInt32(Eval("Availability")) %>
<%# T = Convert.ToInt32(Eval("Threat")) %>
<%# V = Convert.ToInt32(Eval("Vulnerability")) %>
<%# L = Convert.ToInt32(Eval("Likelihood")) %>
Upvotes: 1