G
Guest
Hi Guys, I have a repeater control bound to a sqldataadapter. I have some
rows which are quite large therefore wrapping on to second line. I want to
substring the values on itemdatabound before displayed to user. Can this be
done? or is there any better way to do it.
Here is my code:
<asp:Repeater id="evtRpeater" runat="server"
OnItemDataBound="evt_ItemDataBound">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<tr style="background-color:#718db6">
<th>
Events
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:eeeeee" height="20px">
<td>
<%# DataBinder.Eval(Container.DataItem, "event_title") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr bgcolor="#ffffff">
<td> </td>
</tr>
<tr bgcolor="#ffffff" align="right">
<td>Click here to access Event Calendar</td>
</tr>
</TABLE>
</FooterTemplate> </asp:Repeater>
</TD>
Sub evt_ItemDataBound(ByVal Sender As Object, ByVal e As
RepeaterItemEventArgs)
' This event is raised for the header, the footer, separators, and
items.
' Execute the following logic for Items and Alternating Items.
If (Convert.ToString(e.Item).Length > 25) Then
e.Item.DataItem = Convert.ToString(e.Item).Substring(0, 25)
End If
Thanks
Manny
rows which are quite large therefore wrapping on to second line. I want to
substring the values on itemdatabound before displayed to user. Can this be
done? or is there any better way to do it.
Here is my code:
<asp:Repeater id="evtRpeater" runat="server"
OnItemDataBound="evt_ItemDataBound">
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<tr style="background-color:#718db6">
<th>
Events
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:eeeeee" height="20px">
<td>
<%# DataBinder.Eval(Container.DataItem, "event_title") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr bgcolor="#ffffff">
<td> </td>
</tr>
<tr bgcolor="#ffffff" align="right">
<td>Click here to access Event Calendar</td>
</tr>
</TABLE>
</FooterTemplate> </asp:Repeater>
</TD>
Sub evt_ItemDataBound(ByVal Sender As Object, ByVal e As
RepeaterItemEventArgs)
' This event is raised for the header, the footer, separators, and
items.
' Execute the following logic for Items and Alternating Items.
If (Convert.ToString(e.Item).Length > 25) Then
e.Item.DataItem = Convert.ToString(e.Item).Substring(0, 25)
End If
Thanks
Manny