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 are the various session state management options provided by asp.net?

538


Is it possible to create web application with both webforms and mvc?

532


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?

506


Define the term Web Garden?

548


What is asp short for?

557






What is cookieless session id explain in brief?

523


What is dynamic web page with example?

519


What is use of Master Page in ASP.NET web pages?

621


Is asp.net mvc still used? : Asp.Net MVC

509


What is the function of the ViewState property?

634


Is it true that a Web service must be written in .NET or not?

575


Why is this service branded with windows livetm?

607


How would ASP and ASP.NET applications run at the same time on the same server?

1942


What is the purpose of master page?

512


how to include timer or counting time to display next page in asp.net

1601