Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Q: Eval and casting.

Reply
Thread Tools

Q: Eval and casting.

 
 
Martin Arvidsson, Visual Systems AB
Guest
Posts: n/a
 
      04-04-2008
Hi!

I have a webpage with a DataGrid and a codebehind file containing a method
called OrderStatusText

The line in question in the asp page
<ItemTemplate>

<%# OrderStatusText((byte)Eval("OSTATUS")) %>
</ItemTemplate>

I got the message: Specifyed cast not valid when i ran the page

The method looks like

public string OrderStatusText(byte status)
{
do stuff
return stuff
}

Any idea why it's not possible?

I got the cast code from the msdn2 pages.

Regards
Martin


 
Reply With Quote
 
 
 
 
Andrea Zani
Guest
Posts: n/a
 
      04-04-2008
Martin Arvidsson, Visual Systems AB ha scritto:
> The line in question in the asp page
> <ItemTemplate>
>
> <%# OrderStatusText((byte)Eval("OSTATUS")) %>
> </ItemTemplate>
>
>
> Any idea why it's not possible?


You can write:
<%# OrderStatusText(Convert.ToByte(Eval("OSTATUS"))) %>

> Regards
> Martin


Bye
--
AZ
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
to eval or not to eval? Marc Girod Perl Misc 2 04-19-2011 01:13 PM
eval('07') works, eval('08') fails, why? Alex van der Spek Python 6 01-08-2009 08:24 PM
Different behavior between eval "07" and eval "08" Liang Wang Perl Misc 8 02-02-2008 08:31 PM
DataBinder.Eval and Eval. craigkenisston@hotmail.com ASP .Net 1 06-16-2006 05:33 PM
DataBinder.Eval for an object's property property... like Eval(Container.DataItem,"Version.Major") Eric Newton ASP .Net 3 04-04-2005 10:11 PM



Advertisments