**Problem Description:**

I have a simple dialog with a dropdown list and a textbox.
Depending on the value of the dropdown list the required value could either be simple text, a date or specific text from database. 
For the first case the simple textbox that I have works just fine.
For the second case I need a datepicker.
For the third case I keep the textbox but I add an autocomplete function on it.

My Problem is with the second case. I tried JQuery Datepicker and it works fine but I need to use a different (framework-specific) datepicker which is a server side Web UI control.

When a date type is selected from the dropdownlist I hide the textbox (using JQuery) and I show the (hidden) datepicker and vice versa. The hiding works just fine but when I try to Save, the server side Save function can't recognize when the DatePicker is hidden. 
The reason I need to do that is because I want to know when to save the value from the DatePicker or the Textbox depending on which one is visible at the moment.

I tried everything css related and server just doesn't seem to be able to recognize those attributes as anything else but true.

**Possible Solutions:**

**1)** I could do a "hack" solution and add a hidden textbox and pass a true or false string in it everytime I toggle the datepicker. This way I could check the value of the textbox on save to know if the datepicker is hidden or not.

**2)** Another one (currently testing it) is to create a void function in my .cs file which takes a boolean input and sets a custom visibility attribute that I will add to the datepicker's framework to true or false. 
Whenever I toggle the datepicker I will use an AJAX call to call that function and change the server-side datepicker attribute. 
But I don't know if this attribute will remain changed until I click save or it will somehow go back to its default value. 

**My Question:**
Do any of the solutions above seem ok to you and why?
Can you think of a better one?