Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Dynamic WebDateChooser
posted

I have an ASP.NET web form making an ajax request to a service which returns some html to inject into the page.  The service dynamically renders a usercontrol to a string which is the html returned.  In the usercontrol we have a WebDateChooser.  The WebDateChooser is rendering just fine, but none of the client side events are firing to display the calendar.  The same thing is happening for the WebDateTimeEdit control as well.  Below is a snippet we use to render the usercontrol to a string, which gets returned to the client and injected into the page:

 

            Page pageHolder = new Page();
            UserControl viewControl = pageHolder.LoadControl("~/path/to/control.ascx") as UserControl;

            pageHolder.Controls.Add(viewControl);
            StringWriter output = new StringWriter();
            HttpContext.Current.Server.Execute(pageHolder, output, false);

            return output.ToString();

When i put a WebDateChooser right into a normal page i see a bunch of WebResource.axd requests which pull in necessary js for the control.  I'm not seeing this with the dynamic rendering we are doing, but I don't know how to force these scripts to load(or manually load them myself).  Any help is appreciated.

 

Kyle