title: asp.net Listbox Formatting not persisting after postback
body: <p>I have a ListBox that has highlighted items based on their status. If they are incomplete, they are colored red. After selecting one of the items from the list and displaying it's relate data, the coloring doesn't work. How can I keep this formatting persistent?</p>
  
  <p>Code:</p>
  
  <pre><code>if (!IsPostBack)
          {
              MarkIncompleteList();
              DataTable dt = Data.GetOrderStatusTypes();
  
              ddlOrderStatusTypes.DataSource = dt;
              ddlOrderStatusTypes.DataTextField = "StatusName";
              ddlOrderStatusTypes.DataValueField = "StatusID";
              ddlOrderStatusTypes.DataBind();
  
  
  
  
              if (Request.QueryString["OrderID"] != "")
              {
                  Data.GetOrderByNumber(ref currOrder, Request.QueryString["OrderID"]);
                  DisplayOrderData();
              }
          }
          else
  </code></pre>
  
  <h2>                MarkIncompleteList();</h2>
  
  <pre><code>protected void MarkIncompleteList()
      {
          // get a list of orders that are not complete for allerting
          List&lt;string&gt; iOrders = Data.GetIncomepletedOrders();
  
          lbOrderID.Text = "";
          List&lt;string&gt; ol = Data.GetOrdersList();
          // add the order list to the list box change the color if its in the 
          // incomplete list
          foreach (string s in ol)
          {
              if (iOrders.Contains(s))
              {
                  lbCurrentOrders.Items.Add(s);
                  lbCurrentOrders.Items[lbCurrentOrders.Items.Count - 1].Attributes.Add("style", "color:red");
  
              }
              else
                  lbCurrentOrders.Items.Add(s);
          }
      }
  </code></pre>