How to use set_autoSizeBehaviors in client side?

2 posts, 0 answers
  1. Tony
    Tony avatar
    18 posts
    Member since:
    Sep 2014

    Posted 24 Sep 2014 Link to this post

    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??

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 25 Sep 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top