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

Can I add external css link from client api in javascript?

3 Answers 50 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Pat
Top achievements
Rank 1
Pat asked on 21 Jan 2011, 09:35 PM
I wanted to have a dialog that lists available external stylesheet files and then allow the user to select which ones they want.  However, I don't see any api for then adding these external css links to the editor. Is this possible?

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 24 Jan 2011, 05:33 PM
Hi Pat,

My suggestion is to try the Apply Class dropdown of RadEditor which could be helpful for your scenario. You can populate it with CSS Classes using the CssFiles property.

All the best,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Pat
Top achievements
Rank 1
answered on 24 Jan 2011, 09:34 PM
But this requires me to know the list of CSS files in advance and set them into the editor before sending back to the browser.

However, what if I want to allow the user to pick from available files? I don't just want to blindly include every css file I find.  I have an editor interface with your editor on the first tab.  I wanted to add another tab that would list the css files and then as the user checked off which css files they wanted to include, then I was hoping to use javascript to tell the editor to import that css file. Afterward when they save the file, I would also save the css files they included.  Next time they go to edit the file, I would parse the file, determine the css files and preset these into the editor. But I would still have that tab to allow the user to change which css files to use.
0
Rumen
Telerik team
answered on 27 Jan 2011, 03:15 PM
Hi Pat,

The "Apply Class" dropdown could not be customized on the client, because it is populated with items on the server. The case with setting a CSS file on the client is the same - you cannot modify the CssFiles collection client-side. Also it is not possible to reload the RadEditor's document because it is modified during the load of the control and will not be editable and any added content will be lost.

What you can do is to update the editor using AJAX when the user selects a CSS file from the list. Once the request is send to the server, set the CssFiles property to load the selected by the user class.

Best regards,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
Pat
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Pat
Top achievements
Rank 1
Share this question
or