title: Show unselectable value in dropdownlist
body: <p>I have many drop down lists in many files. I'm trying to write a function to just display "---Please select--" as the default item each time the page loads - which upon post back cannot be selected and hence added to the  database nor added to the list as a new item,. i dont know how to achieve this. instead I'm using insert (which I know is wrong) but i dont know which is the right way to achieve this. please advise</p>
  
  <p>ASPX</p>
  
  <pre><code>&lt;asp:DropDownList ID="DropDownListVType" runat="server" DataSourceID="SqlDataSourceVesselType"
   DataTextField="Vessel_Type" DataValueField="VType_ID" Width="160px" AutoPostBack="False"
    CausesValidation="True" OnDataBound="ddl_DataBound"&gt;
  </code></pre>
  
  <p>CS
  ....</p>
  
  <pre><code>PublicFunctions pubvar = new PublicFunctions();
  
  protected void ddl_DataBound(object sender, System.EventArgs e)
      {
             pubvar.ddl_DB(DropDownListVType);
  
  
      }
  </code></pre>
  
  <p>PUBLIC FUNCTIONS CS</p>
  
  <pre><code> public void ddl_DB(DropDownList d)
  {
      try
      {
          d.Items.Insert(0, new ListItem("--- Please Select ---", String.Empty));
      }
      catch (Exception ex)
      {
          Console.WriteLine("{0} Exception caught.", ex);
      }
  
  }
  </code></pre>
  
  <p>UPDATE:
  PUBLIC FUNCTIONS CS</p>
  
  <pre><code>    public object checkNull (Control c)
      { 
      try{
  
         if (c.GetType()==typeof(TextBox))
         {
             TextBox tb = c as TextBox;
  
           if (!string.IsNullOrEmpty(tb.Text))
              {
                  return tb.Text;
              }
  
          }
  
          if(c.GetType()==typeof(DropDownList))
          {
              DropDownList dl = c as DropDownList;
  
               if ((!string.IsNullOrEmpty(c.??
              {
                  return c.???
              }
  
          }
      }
  
      catch (Exception ex)
      {
          Console.WriteLine("{0} Exception caught.", ex);
      }
      return (DBNull.Value);
  </code></pre>
  
  <p>CALL in PAGE CS</p>
  
  <pre><code>     command.Parameters.AddWithValue("@VType_ID", DropDownListVType.SelectedValue);
  </code></pre>