Solved

asp.net 3.5 if formula

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
send email part1 9 40
ASP.NET Calendar Control 5 29
Build a string of emails from a gridview 2 19
P3P validator , ASP, PHP ,Https and Http links 3 13
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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