Limiting characters brought back from a datalist.

R

Roffers

Hi everyone.

I've got this problem that I really have no idea how to solve.

I have a datalist that brings back x amount of rows, I need to limit
this datalist by 100 characters and then append a "..." to the end.

<asp:DataList id="dlDataList" runat="server"
RepeatDirection="Horizontal" RepeatLayout="Flow">
<ItemTemplate>
<asp:LinkButton Runat="server"
ID="lnkbtn1"><%#DataBinder.Eval(Container.DataItem,
"vc_desc")%></asp:LinkButton>
</ItemTemplate>
<AlternatingItemTemplate>
, <asp:LinkButton Runat="server"
ID="lnkbtn2"><%#DataBinder.Eval(Container.DataItem,
"vc_desc")%></asp:LinkButton>
</AlternatingItemTemplate>
</asp:DataList>

You'll see that the list currently gets rendered like
Item1, Item2, Item3, Item4

I need it to be
Item1, Item2, Item3, Ite...

Can anyone point me in the right direction?

Any help would be appreciated.
Mark
 
J

jb

Roffers said:
Hi everyone.

I've got this problem that I really have no idea how to solve.

I have a datalist that brings back x amount of rows, I need to limit
this datalist by 100 characters and then append a "..." to the end.

<asp:DataList id="dlDataList" runat="server"
RepeatDirection="Horizontal" RepeatLayout="Flow">
<ItemTemplate>
<asp:LinkButton Runat="server"
ID="lnkbtn1"><%#DataBinder.Eval(Container.DataItem,
"vc_desc")%></asp:LinkButton>
</ItemTemplate>
<AlternatingItemTemplate>
, <asp:LinkButton Runat="server"
ID="lnkbtn2"><%#DataBinder.Eval(Container.DataItem,
"vc_desc")%></asp:LinkButton>
</AlternatingItemTemplate>
</asp:DataList>

You'll see that the list currently gets rendered like
Item1, Item2, Item3, Item4

I need it to be
Item1, Item2, Item3, Ite...

Can anyone point me in the right direction?

Any help would be appreciated.
Mark
Mark

You need to add handler for the itemdatabound event. There are plenty of
examples around.

jai
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top