Kevin,
The Eval method returns an object, which you can call ToString on and
then call substring on:
<%# Eval("description").ToString().Substring(0, 50) %>
Or, assuming description is a string field (and you know this), you
could just cast:
<% ((string) Eval("description")).Substring(0, 50) %>

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
> I'm putting a radG:GridTemplateColumn together (which is probably
> irelevant), and within it I'm using a Label, as so:
[quoted text clipped - 5 lines]
> "description", but I've no idea how to change the Eval to do this.. is
> there a way?
Mythran - 30 Nov 2007 16:49 GMT
> Kevin,
>
[quoted text clipped - 17 lines]
>> "description", but I've no idea how to change the Eval to do this.. is
>> there a way?
<asp:Label ID="defaultDescription" runat="server" Text='<%#
Eval("description") == null ? string.Empty : ((string)
Eval("description")).Substring(0, 50) %>
just to be on the safe side :P
Mythran
Kevin Blount - 03 Dec 2007 19:57 GMT
> > Kevin,
>
[quoted text clipped - 31 lines]
>
> - Show quoted text -
Thanks guys.. apprecaite the replies.
I ended up creating anew method, where i can do much more string
manipulation, then return the result. My ASPX page now uses <%#
getDescription() %> (there I can replace chars, truncate the length,
search for "http://" and replace with "<a href='http://'" for example.