title: Watermark in textbox dependent on selected Dropdown ID
body: <p>I have a connected SQL Server database in Visual Studio and am displaying its content in a grid. I created a dropdown menu with the column names as selectable options and a text field to filter for specific content, e.g., DropDown = "Start" - Textfield = 14.03.2015 = Filter Column "Start" for each entry that contains "14.03.2015" - and display it in the Grid.</p>
  
  <p>To make the usage more intuitive, i would like to display text like "dd.mm.yyyy" when for example a option from the dropdown is selected which requires a date as input in my textbox. </p>
  
  <p>The Grid looks like this: <a href="http://abload.de/img/untitled123yqkyn.png" rel="nofollow">http://abload.de/img/untitled123yqkyn.png</a></p>
  
  <p>Below you can find my code for the Grid:</p>
  
  <pre><code>    &lt;asp:DropDownList ID="DropDownList1" runat="server"&gt;
      &lt;asp:ListItem&gt;Organizer&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;Room&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;Creation Time&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;Start&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;End&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;Last Modified&lt;/asp:ListItem&gt;
      &lt;/asp:DropDownList&gt; &amp;nbsp;
  
      &lt;asp:TextBox ID="TextBox1" runat="server" Width="315px"&gt;&lt;/asp:TextBox&gt; &amp;nbsp;
  
  
  
      &lt;asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Search" Width="100px"/&gt; &amp;nbsp;
      &lt;asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Reset Search" Width="100px"/&gt;
      &lt;br/&gt;
      &lt;br/&gt;
  
      &lt;asp:GridView ID="GridView1" runat="server" GridLines="Both" BorderColor="White" BorderStyle="Solid" CellPadding="4" ForeColor="#333333" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" AllowSorting="True"  pagesize="1000" AllowPaging="True" HorizontalAlign="Center" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"&gt;
      &lt;AlternatingRowStyle BackColor="White"/&gt;
  
          &lt;Columns&gt;
          &lt;asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" ItemStyle-HorizontalAlign="Center"  ItemStyle-BorderColor="White"/&gt;
          &lt;asp:BoundField DataField="Organizer" HeaderText="Organizer" SortExpression="Organizer" ConvertEmptyStringToNull="False" HtmlEncode="False" HtmlEncodeFormatString="False" InsertVisible="False" ItemStyle-BorderColor="White"/&gt;
          &lt;asp:BoundField DataField="Room" HeaderText="Room" SortExpression="Room" ItemStyle-BorderColor="White"/&gt;
          &lt;asp:BoundField DataField="DateTimeCreated" HeaderText="Creation Time" SortExpression="DateTimeCreated" ItemStyle-BorderColor="White"/&gt;
          &lt;asp:BoundField DataField="Start" HeaderText="Start" SortExpression="Start" ItemStyle-BorderColor="White"/&gt;
          &lt;asp:BoundField DataField="End" HeaderText="End" SortExpression="End" ItemStyle-BorderColor="White"/&gt;
          &lt;asp:BoundField DataField="LastModifiedTime" HeaderText="Last Modified" SortExpression="LastModifiedTime" ItemStyle-BorderColor="White"/&gt;
          &lt;asp:CheckBoxField DataField="Cancelled" HeaderText="Cancelled" SortExpression="Cancelled" ItemStyle-HorizontalAlign="Center" ItemStyle-BorderColor="White"/&gt;
          &lt;/Columns&gt;
  
      &lt;EditRowStyle BackColor="#2461BF"/&gt;
      &lt;FooterStyle BackColor="#E1000F" Font-Bold="True" ForeColor="White"/&gt;
      &lt;HeaderStyle BackColor="#E1000F" Font-Bold="True" ForeColor="White" Font-Underline="false"/&gt;
      &lt;PagerStyle BackColor="#E1000F" ForeColor="White" HorizontalAlign="Center"/&gt;
      &lt;RowStyle BackColor="#F9F9F9"/&gt;
      &lt;SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333"/&gt;
      &lt;/asp:GridView&gt;
  
      &lt;asp:SqlDataSource ID="xyz" runat="server" ConnectionString="&lt;%$ ConnectionStrings:xyz %&gt;" SelectCommand="SELECT * FROM [xyz]"&gt;&lt;/asp:SqlDataSource&gt;
   &lt;/center&gt;
  </code></pre>
  
  <p></p>
  
  <p>And the C# code i'm using to filter the Grid: </p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e) 
  {
  
  }
  
  protected void Button1_Click(object sender, EventArgs e) 
  {
  
      string FilterExpression = string.Empty;
      if (DropDownList1.SelectedValue.ToString().Equals("Start")) 
      {
  
          FilterExpression = string.Format("Start &gt;= '{0} 0:00:00' AND Start &lt;= '{0} 23:59:59'", TextBox1.Text); 
      }
  
      else if (DropDownList1.SelectedValue.ToString().Equals("End"))
      {
  
          FilterExpression = string.Format("End &gt;= '{0} 0:00:00' AND End &lt;= '{0} 23:59:59'", TextBox1.Text); 
      }
  
      else if (DropDownList1.SelectedValue.ToString().Equals("Creation Time"))
      {
  
          FilterExpression = string.Format("DateTimeCreated &gt;= '{0} 0:00:00' AND DateTimeCreated &lt;= '{0} 23:59:59'", TextBox1.Text); 
      }
  
      else if (DropDownList1.SelectedValue.ToString().Equals("Last Modified"))
      {
  
          FilterExpression = string.Format("LastModifiedTime &gt;= '{0} 0:00:00' AND LastModifiedTime &lt;= '{0} 23:59:59'", TextBox1.Text); 
      }
  
      else 
      {
  
          FilterExpression = string.Concat(DropDownList1.SelectedValue, " Like '%{0}%'");
      }
  
      SqlDataSource1.FilterParameters.Clear();
      SqlDataSource1.FilterParameters.Add(new ControlParameter(DropDownList1.SelectedValue, "TextBox1", "Text"));
      SqlDataSource1.FilterExpression = FilterExpression;
  }
  
  protected void Button2_Click(object sender, EventArgs e)
  {
  
      TextBox1.Text = string.Empty;
      SqlDataSource1.FilterParameters.Clear();
  }
  
  protected void ImageButton_Click(object sender, EventArgs e)
  {
  
      TextBox1.Text = string.Empty;
      SqlDataSource1.FilterParameters.Clear();
  }
  </code></pre>
  
  <p>I would like to have it attached to the if/else if Statments. But i simply lack the knowledge on how to do this.
  Something like this: </p>
  
  <pre><code> if (DropDownList1.SelectedValue.ToString().Equals("Start")) 
          { 
  
           Displaywatermark ("dd.mm.yyyy");
           FilterExpression = string.Format("Start &gt;= '{0} 0:00:00' AND Start &lt;= '{0} 23:59:59'", TextBox1.Text); 
          }
  </code></pre>