Solved

asp.net 3.5 if formula

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reset asp.net login password 4 42
Executing SSIS with a Stored Procedure Permissions 12 57
Regex validation 2 24
Passing Parameter to Stored Procedure 4 23
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…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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