check for specific repeater value - can it be done?

  • Thread starter Thread starter Bob H
  • Start date Start date
B

Bob H

Hi,

I've a data repeater on a form that gets populated from an SP. In the
repeater, I've a ItemTemplate row that outputs the field...

<td colspan="1">
<%# DataBinder.Eval(Container.DataItem, "FieldValue")%>
</td>

....Is there anyway to check the values in this Repeater field as it gets
populated so that I can replace it with another value?? Can it be done and
if so....any pointers please?

Many thanks.

Best regards

Bob
 
See the ItemCreated event for the Repeater class (it will be easier if you
include the value in a control such as label).

Another option would be to change the value in your SQL query (I would
rather use the event when I want to highlight particular values).

Basically (untested) :

Sub Repeater1_ItemCreated(sender As Object, e As RepeaterItemEventArgs)
Dim Label as Label
Select Case e.Item.Type
Case ListItemType.Item,ListItemType.AlternatingItem
Label=e.Item.FindControl("MyLabel")
If Label.Text="Warning" Then
Lable.Text="WARNING"
Label.Font.Bold=True
End If
End Select
End Sub
 
Back
Top