Limit the length of databound text on datalist

  • Thread starter Thread starter Derty
  • Start date Start date
thanks for the reply John. To attempt to clarify, I need to limit the
length of characters that are displayed via text item on a datalist. In
the article link you supplied there's a reference to the following code
that would, I presume, display the 'company name' contained in a table:


<td><%# DataBinder.Eval(Container.DataItem, "CompanyName") %></td>

My question is: how could you limit the number of characters displayed?

The reason for the question is the table field I'm using can be
extremely lengthy in charaters and it doesn't make sense to display
them all on a rendered page.

Thanks.
 
Hey Derty,

You can limit that from the database level like so:

select substring(Columname,1,10) + '...' from tablename

This will return data in this form, limited to 10 characters

data111111....
 
Back
Top