adj
01-19-2009, 09:46 AM
Is there a way to do an "if" in-line? Here's the jist of what I want to accomplish (semi-psudo-code)
<asp:Label ID="lblOpt01percent" runat="server" Text='<% # if( totalvotes == 0){ result is 0}else{ do calculations for result } %>' >
I have the calcuations working, except when there are zero totalvotes, then I get a divide by zero error, which is what I'm trying to work around in the above. But when I tried to put the if-statement in, I get an error "Invalid expression term 'if'". Is there another way to accomplish this?
<asp:Label ID="lblOpt01percent" runat="server" Text='<% # if( totalvotes == 0){ result is 0}else{ do calculations for result } %>' >
I have the calcuations working, except when there are zero totalvotes, then I get a divide by zero error, which is what I'm trying to work around in the above. But when I tried to put the if-statement in, I get an error "Invalid expression term 'if'". Is there another way to accomplish this?