raven daniel

raven daniel

  • 1.5k
  • 123
  • 41.3k

Change the forecolor of an item in a repeater based on the status?

Nov 29 2011 2:36 AM
public string CompanyStatus(int iStatus)
  {
  string strCompanyStatus = string.Empty;

  if (iStatus == 2 || iStatus == 3)
  {
  //foreach (RepeaterItem ri in rptCompanies.Items)
  //{
  //  if (((Label)ri.FindControl("RowStatus")).Value == '2')
  //  foreach (Control ctl in rptCompanies.Controls[iStatus].Controls)
  //  {
  //  if (!ctl.GetType().Equals(typeof(Label)))
  //  continue;

  //  ((Label)ctl).ForeColor = System.Drawing.Color.Red;
  //  }
  //}
  return "style='backGround-color:red'";
  }
  return strCompanyStatus = iStatus == 1 ? "Active" : "InActive";
  }
  #endregion


 <ItemTemplate>
  <tr>
  <td>
  <%# CompanyStatus((Int32)DataBinder.Eval(Container.DataItem, ("RowStatus")))%>
  </td>
  </tr>
</ItemTemplate>



This is basicaly what im looking for. if the status is 2 or 3, The forecolor of that item for the repeater must appear in red, and yes im newish :) . Using Visual 2010, C#, asp.net. Windows 7.?

Answers (1)