Solved

asp.net 3.5 if formula

Posted on 2011-09-16
2
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

717 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