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

How to use set_autoSizeBehaviors in client side?

1 Answer 46 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 24 Sep 2014, 06:54 PM
Is there an example on how to use the set_autoSizeBehaviors method? The documentation in this page: http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html has this text "For example: (Telerik.Web.UI.WindowAutoSizeBehaviors.Width + Telerik.Web.UI.WindowAutoSizeBehaviors.Height)". It's not clear how to use it. Without quotes there's a Javascript. What is "Telerik.Web.UI.WindowAutoSizeBehaviors' in JS? If put inside quotes it doesn't seem to have any effect.

So what's the syntax exactly??

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 25 Sep 2014, 11:34 AM

Hi Tony,

Telerik.Web.UI.WindowAutoSizeBehaviors is an enumeration that our scripts create. It boils down to integers, but we create and enum so it is easier to use. Using them as strings will not have a valid result.

Here is a basic example that will let you see the difference:

<telerik:RadWindow ID="RadWindow1" runat="server" AutoSize="true">
    <ContentTemplate>
        <div style="width: 500px; height: 500px; background: yellow;"></div>
    </ContentTemplate>
</telerik:RadWindow>
<asp:Button ID="Button1" Text="autosize on width" OnClientClick="onWidth(); return false;" runat="server" />
<asp:Button ID="Button2" Text="autosize on height" OnClientClick="onHeight(); return false;" runat="server" />
<script type="text/javascript">
    function onWidth() {
        var wnd = $find("<%=RadWindow1.ClientID%>");
        wnd.set_autoSizeBehaviors(Telerik.Web.UI.WindowAutoSizeBehaviors.Width);
        //reset to default dimensions so you cans see the difference when show() causes an autoSize()
        wnd.setSize(300, 300);
        wnd.show();
    }
 
    function onHeight() {
        var wnd = $find("<%=RadWindow1.ClientID%>");
        wnd.set_autoSizeBehaviors(Telerik.Web.UI.WindowAutoSizeBehaviors.Height);
        //reset to default dimensions so you cans see the difference when show() causes an autoSize()
        wnd.setSize(300, 300);
        wnd.show();
    }
</script>



Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Tony
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or