How can you provide an alternating color scheme in a
Repeater control?

Answer Posted / rey vegafria

in UI...

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<tr bgcolor="<%#getColor()%>">
<td align="center"><%#Container.DataItem("name")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>


in Source Code...

Partial Class _Default
Dim strColor As String = "#ffffff"
...

Function getColor()
If strColor = "#ffffff" Then
strColor = "#E0F4F8"
getColor = "#ffffff"
Else
strColor = "#ffffff"
getColor = "#E0F4F8"
End If
End Function

End Class

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is post back in asp.net?

724


How to disable validator control by client side JavaScript?

783


In the Repeater control which way you can edit?

872


Is it possible to apply themes to an asp.net application? If yes, then how?

810


How is it possible for .NET to support many languages?

518


Explain asp.net web forms.

838


Why web api is better than wcf?

816


What are the differences between clr & cts?

766


What are server objects?

732


In a page I have gridview with options of select and delete using hyperlink when I am selecting any one of then it has to open another page how can it?

733


What is application variable?

732


if i want to give an alert message like "try after sometime" to a web page which is being seen by other person.if a web page is not seen by anyone then it should display otherwise it show a display a message stating that other person is viewing so try after some time........how can i implement this.

2040


What will happen if the server confugration file and the application confugration file have different values for sassion state ASP.NET?

1014


In which event of the page life cycle, is the viewstate available?

717


What is a url string?

831