I'm creating a couple of datepickers programatically and I'm adding them to Panel object. I'm trying to add an attribute to the datepickers when they're created to run a JavaScript that opens the calendar when the input box of the date picker is clicked. This works great for datepickers that I've created on the client side and add this attribute server side, but when I create the datepickers server side, I'm not getting the full ClientID.
here is how I'm creating the datepickers and setting the attributes:
when I look at the page source, it's referencing the ID being passed to the JavaScript as just "dp_ENDDATE" without all the other pathing that goes along with it. The client id should look like this
ctl00_MainContent_ctl00_RadGrid2_ctl00_ctl02_ctl02_dp_ENDDATE_dateInput_text
Is there a way to set this up so I can assign the JavaScript to the DateInput server side when the control is created? Thanks.
here is how I'm creating the datepickers and setting the attributes:
Panel edpanelContent =
new
Panel();
edpanelContent.Attributes.Add(
"class"
,
"popupcontent"
);
RadDatePicker eddp =
new
RadDatePicker();
eddp.ID =
"dp_ENDDATE"
;
eddp.DateInput.Attributes[
"onclick"
] = String.Format(
"showPopUp('{0}');"
, eddp.ClientID);
edpanelContent.Controls.Add(eddp);
when I look at the page source, it's referencing the ID being passed to the JavaScript as just "dp_ENDDATE" without all the other pathing that goes along with it. The client id should look like this
ctl00_MainContent_ctl00_RadGrid2_ctl00_ctl02_ctl02_dp_ENDDATE_dateInput_text
Is there a way to set this up so I can assign the JavaScript to the DateInput server side when the control is created? Thanks.