Live Chat Icon For mobile
Live Chat Icon

How to change the row color of the Repeater based on some condition

Platform: ASP.NET| Category: Repeater

<asp:Repeater ID='Repeater1' Runat='server' EnableViewState='False'>
	<tr <%# FormatColorRow(DataBinder.Eval(Container.DataItem,'UnitPrice').ToString()) %> >
	<td >
	<%# DataBinder.Eval(Container.DataItem,'UnitPrice').ToString() %>


Protected Function FormatColorRow(strUnitPrice As String) As String
Dim unitprice As Double = Double.Parse(strUnitPrice)
If unitprice <= 15 Then
	Return 'style=’backGround-color:red’'
	Return 'style=’backGround-color:green’'
End If
End Function ’FormatColorRow 


protected string FormatColorRow(string strUnitPrice)
	double  unitprice  =double.Parse ( strUnitPrice);
	if ( unitprice <= 15)
		return 'style=’backGround-color:red’';
		return 'style=’backGround-color:green’';

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.