Solved

asp.net 3.5 if formula

Posted on 2011-09-16
2
308 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

12 Experts available now in Live!

Get 1:1 Help Now