Limiting characters brought back from a datalist.

  • Thread starter Thread starter Roffers
  • Start date Start date
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
 
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
 
Back
Top