check for specific repeater value - can it be done?

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
 
P

Patrice Scribe

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
 

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,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top