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

resize radwindow based on content NOT onload

7 Answers 610 Views
Window
This is a migrated thread and some comments may be shown as answers.
Sathish
Top achievements
Rank 1
Sathish asked on 25 Jan 2012, 02:48 AM
Hi,

I need some help. I have a radwindow with contenttemplate. i want it to behave like a regular div, or lets say like the jquery ui window where the window height increases LIVE based on html instead of calling autosize or setting width and height on every move.

what i have inside is a radasync upload, when you upload files in async, the list of files uploaded gets appended and a scroll bar appears, instead i want the window size to increase. i know i could use the client side api of radasync upload to trigger window size, but i'm interested in a clean method where the radwindow behaves like a div.

is there a hack to do it? like setting height to auto or to set display as table or something? if not, can telerik introduce such feature? i wanted to use the jquery ui, but to be consistent with the theme and ability to post back / control state from server end, i prefer radwindow.

please let me know if there is  a solution.

thanks.

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 25 Jan 2012, 01:43 PM
Hello,

You can set AutoSize property of RadWindow as true which gets or sets a value indicating whether the window will automatically resize itself according to its content page or not.

Thanks,
Princy.
0
Sathish
Top achievements
Rank 1
answered on 25 Jan 2012, 05:47 PM
The AutoSize property works only for the first time or whenever a page is fully loaded. If the contents are manipulated through javascript then, the window does not resize.
0
Svetlina Anati
Telerik team
answered on 26 Jan 2012, 11:01 AM
Hi Sathish,

 As far as I understood from your explanations, the RadWindow autosizes fine when it is initially opened. After that you change the size of the content and the RadWindow stays the same size. This is the correct behavior by design - the RadWindow automatically autosizes when it is opened. To make it autosize again explicitly, you should call its method autoSize when you change the content size. The autoSize method is documented below:

http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html

and you can make the make the RadWindow autosize itself with an animation or not, controlling that with an input parameter.

In addition, you can see this in action in our online demo below:

http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx

When you open the RadWindow and you show the calendar dropdown, the RadWindow autosizes itself. When the calendar dropdown is hidden, the window autosize back to the changed size.

Please, examine the provided resources and use the suggested approach. In case you still experience problem, please share sample demo page - there is no need to show your actual content, just put the same elements and logic - e.g DIV, random strings, etc since the content information, databases, etc itself is not what matters in the case but the layout configuration.

Kind regards,
Svetlina Anati
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Sathish
Top achievements
Rank 1
answered on 27 Jan 2012, 05:45 PM
I understand this part. But it is NOT the functionality i am looking for. I have some scripts that manipulate the contents of the radwindow which will cause it to expand in the client end. To keep it atomic, I need the radwindow to resize to its content as the dom elements are being added INSIDE the radwindow. When using radwindow in contenttemplate mode,

I found the solution, by setting the css

.rwWindowContent > div:first-child
{
    height: auto !important;
}

.rwTable
{
    height: auto !important;
}

but doing this will disable the ability to resize the window. i want the use to be able to resize the window, but it should grow when the contents go beyond the user resized height, so when the user resizes, if radwindow can use that as a min height and if the height property is set to auto, then the issue will be resolved.

You can provide options in the radwindow to set the clientside resize mode.

Do you think this is something telerik might be able to incorporate in their next release?


0
Svetlina Anati
Telerik team
answered on 31 Jan 2012, 12:49 PM
Hi Sathish,

 Did you test my suggestion? It does exactly what you explain - what you should do is to explicitly call autoSize when you change the content (adding DOM elements in your case and showing a calendar dropdown in the demo - it does not matter as far it changes the size of the content).

Since from your last post what I again understand is exactly what I suggest, in case your problem persists, please share fully working sample code with my suggestion implemented and reproduction steps and screenshots of what exactly does not work in this manner. Once I receive this, I will get e better understanding why this approach does not work for you and I will fix it for you.

Regards,
Svetlina Anati
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Sathish
Top achievements
Rank 1
answered on 31 Jan 2012, 04:15 PM
Hi Anati,

yes. I understand and that is that I have been doing in many places, but i have more complex scenarios where the window will get resized by MANY client scripts and i dont want to call it from every spot.

i want a window which can resize itself using css only.

can you add an option to radwindow which will allow this? it should be a fairly simple solution.

0
Svetlina Anati
Telerik team
answered on 01 Feb 2012, 04:16 PM
Hello Sathish,

RadWindow contains complex HTML and many elements which have different configuration and behavior depending on the features used. If we simply change the CSS  to have auto height, this will reflect in features not correctly working (e.g limiting the width and height, restriction zone, etc). If your scenario is a simple one and you can make it work as you require with the mentioned CSS, you can go ahead and override the default styles. However we strongly recommend to use autosize instead because if you change the defaults in that manner you explain, we do not ensure that other features will work correctly and it will be up to you to resolve them with your customizations.

Regards,
Svetlina Anati
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Window
Asked by
Sathish
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Sathish
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or