This question is locked. New answers and comments are not allowed.
Can these controls not be hidden? I have a form where I need to display a DatePicker, but only if a certain selection is made from another drop-down. Now, I thought that I could simply declare a DatePicker control on the page and set Visible to false, and then change this property in Javascript when the selection is made, but the DatePicker control doesn't seem to have a Visible property (as most other MVC controls do).
I also tried setting appropriate HtmlAttributes with style = "display: none;", but that didn't work either.
What also doesn't work is wrapping the DatePicker control in a DIV with style = "display: none;" as that actually renders 2 DatePicker controls, the one inside the div as expected and a completely separate one outside of the DIV, which seems to be replacing the standard textbox I have currently in place. However, this latter behavior seems strange to me and I'm going to continue troubleshooting it. I think some HTML might be getting cached somewhere and not because of the DatePicker control itself.
The only other option I see is to create a new DatePicker control in Javascript on the fly, but that can get messy and I'd rather not have to go that route. If anyone has any insight or help, that would be great. Thanks. I might see if I can add a Visible() method for the DatePicker control myself as it seems like it should be rather easy to implement.
I also tried setting appropriate HtmlAttributes with style = "display: none;", but that didn't work either.
What also doesn't work is wrapping the DatePicker control in a DIV with style = "display: none;" as that actually renders 2 DatePicker controls, the one inside the div as expected and a completely separate one outside of the DIV, which seems to be replacing the standard textbox I have currently in place. However, this latter behavior seems strange to me and I'm going to continue troubleshooting it. I think some HTML might be getting cached somewhere and not because of the DatePicker control itself.
The only other option I see is to create a new DatePicker control in Javascript on the fly, but that can get messy and I'd rather not have to go that route. If anyone has any insight or help, that would be great. Thanks. I might see if I can add a Visible() method for the DatePicker control myself as it seems like it should be rather easy to implement.