Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datalist with Conditional Formatting

Status
Not open for further replies.

Halliarse

IS-IT--Management
Jan 8, 2007
213
0
0
GB
Hi

Can anyone advise how I change the colour of the 'SINST' dataitem value to red if it is say under 50?

<td width="60" align="center"><%# GetPatchInstall(DataBinder.Eval(Container.DataItem,"SINST")) %></TD>

Please advise if you need to see further code or need further information.

Thanks

Steve
 
I would remove the code from the HTML, this is more like classic ASP.NET coding.
I would instead place a literal or label object there, and in the code-behind (ItemDataBound event), use .FindControl("your label name") to get a reference to the control.
From there, you can check the value and set the background color of the literal or label accordingly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top