Dynamically Injected Controls (client-side) - No Skin Applied

2 posts, 0 answers
  1. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 02 Oct 2013 Link to this post

    I am not really sure where this subject belongs, but I may be chalking it up to the RadStyleSheetManager?  Don't ask me how we do it, but we do it successfully; we load UserControls dynamically at runtime and inject them into Telerik's RadTreeNodes allowing users the capability to edit all Nodes at once and persist their changes once (multi-edit, batch saving).  We even load all Scripts relevant to those dynamically injected controls and eveything works great!  Functionally speaking...

    However, the ONLY ISSUE we are having, is that the Styles and Skins are NOT being applied to the Telerik controls (ComboBoxes, DatePickers, etc.) that are dynamically injected into the DOM on the client-side... UNLESS one of those types of controls (ComboBox, DatePicker, RadInput, etc.) is ALREADY loaded on the Page before it has been injected dynamically.  For example, if anywhere on the Page there is another DatePicker, then the dynamically added control will have it's styles/skins applied correctly.  If there is NO other control of that particular type, then the styles/skins are NOT even loaded nor do they appear to be anywhere linked in the page.  I can inspect the JavaScript that injects the controls, and YES, it is passing in the Skin name to the newly created control ($create call).

    We attempted to "force" this by using the RadStylesheetManager to "preemptively" load the Styles we knew we'd need, but it seems the Stylesheet manager is NOT loading all the styles we tell it to, again, unless that particular type of control is put on the Page from the first request.

    I do not feel like putting one control each of the ones we dynamically load JUST so the styles will display correctly.  So, is there any work-around for this?  I cannot upload a sample project as it's much too involved and intellectual property is involved as well.
  2. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 02 Oct 2013 Link to this post

    Actually, I have figured this out.  Seems we were stripping off the "link" elements that get embedded between the DOM elements that the Telerik controls render.  Once we let those alone, the styles work correctly when injected.  However, there is a small delay between the control showing up and then applying the styles.  It'll do for now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top