Hi,
i managed to set the width of 1 html editor using this way in the C# code
txtDescription.Width = Unit.Pixel(480);txtDescription.Height = Unit.Pixel(350);but my page has about 20 editors and some editor are created dynamically via the asp:Repeater.
is there any way to set the height and width of all the editor like for example in ToolsFile.xml or config file?
i would prefer not to touch the editor ascx file as my web application just reference the dll and i do not have the ascx file
5 Answers, 1 is accepted
Hi Benjamin,
You have several options:
- use ASP Themes
- access the control in the ItemDataBound event of the repeater
- traverse all controls recursively, check their type and set values
- do that on the client via the setSize method
Regards,
Telerik
Hi Marin thanks for the reply.
i would like to check how do i resize those editor not in repeater?
i tried this but it is not entering the if(ctrl is RadEditor)
01.foreach(Control ctrl in Page.Controls) 02.{03. if (ctrl is RadEditor)04. {05. RadEditor control = ctrl as RadEditor;06. ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Now setting "+ control.ClientID +" width')", true);07. 08. if (control != null)09. {10. control.Width = Unit.Pixel(width);11. control.Height = Unit.Pixel(height);12. }13. else14. {15. ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Control " + ctrl.ClientID +" not found')", true);16. return; 17. }18. }19.}Hi Benjamin,
Try looping through the form's collection, because the Page contains just the Form object.
foreach (Control ctrl in form1.Controls)I also advise that you look into recursive traversal in case the editor is in a Panel or other control.
Regards,
Telerik
his Marin,
sorry for asking this as this is the first time i traverse asp control.
how do i do recursive traverse as the editor is inside RadMultiPage, RadPageView control
Hello,
There are numerous examples of recursive traversals in the net, for example:
- https://blog.codinghorror.com/recursive-pagefindcontrol/
- http://stackoverflow.com/questions/4955769/better-way-to-find-control-in-asp-net
- https://www.google.com/search?q=recursive+find+control
Regards,
Telerik