Reputation: 1007
I have a textbox on which I'm using jQuery DatePicker. It works fine when the textbox has no value. I have a button on whose click I'm populating this textbox with a datevalue. Then, if I click on the textbox the datepicker does not appear. I tried populating the date in both the formats.
<script>
$(function () {
$('#InputNamesBirthday').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd-mm-yy",
defaultDate:null,
altFormat: "yy-mm-dd"
});
});
</script>
birthDate = Convert.ToDateTime(dataReaderNames["BORN"]);
InputNamesBirthday.Text = birthDate.ToString("yyyy-MM-dd", CultureInfo.CreateSpecificCulture("en-US"));
Thanks, Dev
Upvotes: 0
Views: 1464
Reputation: 7591
the problem is most likely the jquery selector. this is a common problem with webforms. the Server ID rarely matches the Client ID. this is because webforms auto-generates IDs based on the containers a control is nested in. fore example a text box in a repeater, in a user control, on a page, with a master page will produce a client id something like this.
master$usercontrol$repeater$0$textbox
the cleanest way to solve this is to use a class selector to access the element, rather than an ID.
Upvotes: 1