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
Dynamically rendered WebDateChooser not functioning clientside
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

Parents
No Data
Reply
  • 24497
    posted

    Hi Kyle,

    That is correct. All Infragistics controls depend on js files and initialization scripts which create controls. In case of Infragistics.WebUI controls like WebDateChooser, it is rather easy to use local js files. Custom location of js files can be modified on global level within webconfig file or for every particular control. In second case, the only requirement is that location of ig_shared.js file should be the same for all controls on page.
    WebDateChooser uses 3 js files: ig_webdropdown.js, ig_calendar.js and ig_shared.js. Those js files and js files for other controls come with installation of NetAdvantage.
    Below is example to set local js files for WebDateChooser:

    <igsch:WebDateChooser ID="WebDateChooser1" runat="server" CalendarJavaScriptFileName="./js/ig_calendar.js" JavaScriptFileName="./js/ig_webdropdown.js" JavaScriptFileNameCommon="./js/ig_shared.js"></igsch:WebDateChooser>

    However, if a page, where html string for webdatechooser with its init-javascript are inserted, will have those js file loaded, then control should work and no need to adjust any settings, which I mentioned above.

Children