This is a migrated thread and some comments may be shown as answers.

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

1 Answer 15 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 03 Oct 2013, 01:32 AM
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.

1 Answer, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 1
answered on 03 Oct 2013, 03:34 AM
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.
Tags
ScriptManager and StyleSheetManager
Asked by
Tim
Top achievements
Rank 1
Answers by
Tim
Top achievements
Rank 1
Share this question
or