Ajax calendar extender

hello friends,

I used ajax toolkit 3.5 for calendar extender and i placed restrictions for a specific period on the calendar. I put this restriction on master page as a different period is selected by different login user. So according to login user period is restricted in whole application. I put the code in master page as below:

foreach (Control ctrl in ContentPlaceHolder1.Controls.OfType<AjaxControlToolkit.CalendarExtender>())
{
if (ctrl is AjaxControlToolkit.CalendarExtender)
{
((AjaxControlToolkit.CalendarExtender)(ctrl)).StartDate = Convert.ToDateTime("2017/01/01");
((AjaxControlToolkit.CalendarExtender)(ctrl)).EndDate = Convert.ToDateTime("2017/01/30");
}
}

it is working fine for each page without updatepanel, but when i put updatepanel, this restriction is removed. So kindly provide some solution for this issue.

Thanks in Advance,
Sonal Patel