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

add toolbar dynamically in combination with LoadToolsFile

2 Answers 140 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Aldert
Top achievements
Rank 2
Aldert asked on 30 Sep 2008, 09:25 AM

Hi,
I have a problem with adding a toolbar in code in combination with the LoadToolsFile method of the RadEditor. When I use only one of them everything works fine. But when I use them both I only see the toolbar added from code. It doesn't change when I call the SetToolbar method after the creation of the dynamic toolbar.

I have the following code:

SetToolbar();

//add a new Toolbar dynamically

EditorToolGroup dynamicToolbar = new EditorToolGroup();

radTextEditor.Tools.Add(dynamicToolbar);

//add a custom dropdown and set its items and dimension attributes

EditorDropDown ddn = new EditorDropDown("DynamicDropdown");

ddn.Text =

"Dynamic dropdown";

//Set the popup width and height

ddn.Attributes[

"width"] = "110px";

ddn.Attributes[

"popupwidth"] = "240px";

ddn.Attributes[

"popupheight"] = "100px";

//Add items

ddn.Items.Add(

"Project Name", "{Project.Name}");

ddn.Items.Add(

"Person Firstname", "{Person.FirstName}");

ddn.Items.Add(

"Person Zipcode", "{Person.ZipCode}");

//Add tool to toolbar

dynamicToolbar.Tools.Add(ddn);

The method SetToolbar does the following:

private

void SetToolbar()

{

DAData dab = new DAData(ConfigurationManager.ConnectionStrings["configuration"].ConnectionString);

dab.CommandName =

"usp_RadEditorTools_Load";

dab.AddSqlParameter(

"projectId", long.Parse(ConfigurationManager.AppSettings["CNGRSProject"]));

dab.AddSqlParameter(

"resourceId", this.ResourceId);

string ret = (string)dab.GetReturnValue();

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.LoadXml(ret);

radTextEditor.LoadToolsFile(xmlDoc);

radTextEditor.EnsureToolsFileLoaded();

}

I guess I'm forgetting something... but I just cannot see what that is.
Can anybody help me on this one?

Bye,

Aldert

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 03 Oct 2008, 07:24 AM
Hi Aldert,

This is how the editor currently work and we do not plan to change this behavior for the time being.

You cannot combine both ways of creating new tools. You should choose either to load the tools only via the XML file or to create them with the server side api and collections of RadEditor.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Aldert
Top achievements
Rank 2
answered on 03 Oct 2008, 08:42 AM
Hi Rumen,

That's a clear, yet little diappointing, answer!

However it shouldn't be too hard to do this with the server API.

Thanks again.

Bye,

Aldert
Tags
Editor
Asked by
Aldert
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Aldert
Top achievements
Rank 2
Share this question
or