dialogBase.resizeToContent()
My control designer is not resizing based on the size of the contents, (including a dynamically updated RadGrid), even when I explicitly add "dialogBase.resizeToContent()" after the script which triggers the elements to change size. Even the initial size seems off for the empty grid.
I am curious how "resizeToContent" works. Do I have to have a specific type of content in the control in order for it to work (such as "block" type elements only at the top level)?
Do I have to use CSS to size the contents ahead of time, perhaps?
Hello Jeff,
Could you send us the source for your designer so we could examine it and see what happens? Do you get any Javascript errors during the loading/showing of your designer in the dialog?
Greetings,I can't send my source, and it would be too complicated to get it running anyway, as it relies on non-public web services.
However, I am interested in general knowlege about this topic, such as how the "resizeToContent" works, what kind of content has to be present, and how it interacts with sizes specified in CSS. Is there a best practice for creating the content so that "resizeToContent" will work correctly, and the control will be sized correctly initially? Also, is there any reference material on the subject, or examples you can point me to?
Hi Jeff,
The resizeToContent function is based on RadWindow. Since its contents is inside an IFRAME, the browser is able to calculate the needed amount of space required to display all the elements in the nested IFRAME document, so the function basically resizes the IFRAME wrapper.
You could see the source of this function if you load Telerik.Sitefinity.dll with a tool like Reflector and navigate its resources to Telerik.Sitefinity.Web.Scripts.AjaxDialogBase.js - there is the function
resizeToContent: function (oWnd)
...