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

What is server side routing?

511


What's the use of formatters in .net?

576


Where is the view state data stored?

578


What is asp.net version?

538


What is protected configuration?

604






Where sessions are stored in asp.net?

543


Define session in asp.net.

561


What is the size of Get method and how much data it can store?

577


I have an external link in my application say www.xyztest.com. Today this site works on http protocal. Tommorow it may run on https. So i cant hardcore the protocal in the site. When a user clicks on the link how can i know if the external site works on http or https and takes him to that place?

1471


Is asp.net web forms dead?

517


What is globalization and localization in asp net?

498


What is bound controls

592


What is the differences between a primary key and a unique key in sql server?

540


Can you explain how ASP.NET application life cycle and page life cycle events fire?

578


How can we inherit a static variable?

548