Retrieving substring of a bound value

Posted by shivesh on Stack Overflow See other posts from Stack Overflow or by shivesh
Published on 2010-05-10T12:43:01Z Indexed on 2010/05/10 12:54 UTC
Read the original article Hit count: 190

Filed under:
|
|

I am binding some data to control, but want to limit the number of character of a specific field to a 30 first characters.

I want to do it, if it's possible, on aspx page.

I tried this:

Text='<%# String.Format("{0}", Eval("Title")).Substring(0,30) %> '

But got this error:

Index and length must refer to a location within the string. Parameter name: length

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#