Solved

asp.net 3.5 if formula

Posted on 2011-09-16
2
309 Views
Last Modified: 2012-06-22
Hello

New to ASP.net.

I'm having with an if formula.  can someone help
if ((DataBinder.Eval(e.Row.DataItem, "Visits Remaining")) > 0)

erros is that operator '>' cannot be applied to operands of type 'object' and 'int'

thanks
0
Comment
Question by:ptemo
2 Comments
 
LVL 21

Accepted Solution

by:
Craig Wagner earned 500 total points
ID: 36552133
DataBinder.Eval(e.Row.DataItem, "Visits Remaining") returns an object and you can't directly compare an object to an int (i.e. 0). You'll need to convert the results of your DataBinder expression to an int. The following should work.

Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Visits Remaining"))
0
 

Author Comment

by:ptemo
ID: 36557885
it worked

thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now