Skip to content Skip to sidebar Skip to footer

Datepicker For Dynamically Created Controls

I have a page with a number of dynamic controls. For some of the dynamically created textboxes, I'd like to add calendar control using jQuery (Keith Wood) Normally, if the textbox

Solution 1:

You can add a css Class name to your editor that hold the Calendar and attach the datepicker base on that, eg:

TextBoxtxtValue=newTextBox();
        txtValue.Width = 250;
        txtValue.CssClass = "TheDateTimePicker";

and on script:

$(function () {
  $('.TheDateTimePicker').datepick({ dateFormat: 'dd MM yyyy' });
});

You can use the same css class name for all the editors that keep this date control, without change anything else. This $('.TheDateTimePicker') selector will apply the "datepick" to all controls that have that css class.

Post a Comment for "Datepicker For Dynamically Created Controls"