Asp.net, vb.net, C#.net Resources
Welcome to Asp.net, vb.net, C#.net Resources
Sign in
|
Join
|
Help
in
Repeater (forum)
FAQs (group)
(Entire Site)
Search
Home
Blogs
Forums
Downloads
Asp.net, vb.net, C#.net Resour...
»
FAQs
»
asp.net Faqs
»
Repeater
»
Re: How to change the row color of the Repeater based on some condition?
How to change the row color of the Repeater based on some condition?
Last post 08-22-2006, 7:09 AM by
Webdeveloper
. 1 replies.
Sort Posts:
Oldest to newest
Newest to oldest
Previous
Next
08-21-2006, 5:24 AM
324
Webdeveloper
Joined on 08-19-2006
Posts 1,589
How to change the row color of the Repeater based on some condition?
Reply
Quote
How to change the row color of the Repeater based on some condition?
Report abuse
08-22-2006, 7:09 AM
704
in reply to
324
Webdeveloper
Joined on 08-19-2006
Posts 1,589
Re: How to change the row color of the Repeater based on some condition?
Reply
Quote
<asp:Repeater ID="Repeater1" Runat="server" EnableViewState="False">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr <%# FormatColorRow(DataBinder.Eval(Container.DataItem,"UnitPrice").ToString()) %> >
<td >
<%# DataBinder.Eval(Container.DataItem,"UnitPrice").ToString() %>
</td>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
VB.NET
Protected Function FormatColorRow(strUnitPrice As String) As String
Dim unitprice As Double = Double.Parse(strUnitPrice)
If unitprice <= 15 Then
Return "style='backGround-color:red''
Else
Return "style='backGround-color:green''
End If
End Function 'FormatColorRow
C#
protected string FormatColorRow(string strUnitPrice)
{
double unitprice =double.Parse ( strUnitPrice);
if ( unitprice <= 15)
{
return "style='backGround-color:red'';
}
else
{
return "style='backGround-color:green'';
}
}
Report abuse
Powered by
Megasolutions ltd