title: Text Align DropDownList List Item CENTER using datarowview
body: <p>I have tried all CSS imaginable in Table and paraent controls, and I am populating and formatting a DropDownList using DataRowView in a DataList Control in .NET 3.5 C#.  But I can not for the life of me, CENTER the LIST ITEMS in the Drop Down List..  What would be easiest it seems is use the same formatting procedures I am now using in page behind... here is code.</p>
  
  <p>Trust me Div tags do not work on the List Items.. nor does CSS.</p>
  
  <p>How do I set text-align: Center ?? </p>
  
  <pre><code>    if (on == "True")
      {
          DropDownList dl1 = (DropDownList)e.Item.FindControl("ddlOn");
          dl1.BackColor = System.Drawing.Color.LightGreen;
          dl1.ForeColor = System.Drawing.Color.White;
          dl1.Font.Bold = true;
          ListItem li = dl1.Items.FindByValue("True");
          if (li != null)
          {
              li.Selected = true;
          }
      }
  </code></pre>
  
  <p>Here is DropDownList in ItemTemplate of DataList Control.</p>
  
  <pre><code>                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;asp:DropDownList ID="ddlOn" runat="server"
                                  AutoPostBack="True" Width="100%" CssClass="cen3"&gt;
                              &lt;asp:ListItem&gt;True&lt;/asp:ListItem&gt;
                              &lt;asp:ListItem&gt;False&lt;/asp:ListItem&gt;
                          &lt;/asp:DropDownList&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
  </code></pre>