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

Autosize radwindow when content inside radwindow increases

2 Answers 168 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mattias Moberg
Top achievements
Rank 1
Mattias Moberg asked on 13 Nov 2010, 02:02 PM
Hi.
I need to achieve method to autosize radwindow when content inside radwindow increases. The way im doing as follow below does not work for me. Any one that can help me out?
Using: Version: 2010, 2, 713, 35

This is how im opening radwindow:

GalleryPage.aspx
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
                                              Skin="Black" Modal="true" EnableShadow="true"
                                              DestroyOnClose="true" AutoSize="true"
                                              VisibleStatusbar="false" ShowContentDuringLoad="false">
</telerik:RadWindowManager>
.......
<asp:LinkButton id="showImageFromThumbnail2" runat="server" OnClientClick='<%# "window.radopen(\"GalleryImage.aspx?id=" + DataBinder.Eval(Container.DataItem,"GalleryId") + "\",\"GalleryWindow\"); return false;" %>'>

GalleryImage.aspx
<script language="javascript" type="text/javascript">
  
   var galleryWin = null;

   function pageLoad() {
          galleryWin = $find("<%= RadWindowManager1.ClientID %>");
   }

    function toggleExpand(clickedLink) {

        $telerik.$('#hiddenContent').toggle();
        //change link's text

        if ($telerik.$(clickedLink).text() == "Show more") {
            $telerik.$(clickedLink).text("Show less").addClass("showLess");
        }
        else {
            $telerik.$(clickedLink).text("Show more").removeClass("showLess");
        }
        //autosize the gallery window
        galleryWin.autoSize(true);
    }
</script>
.......
            <div id="hiddenContent" style="display:none; padding:10px;">
                 <div style="width:100%; background-color:#ff0000;">
                        <h2>Title</h2>
                         <p>info..</p>
                 </div>
            </div>
            <a id="toggleLink" href="javascript:void(0);" class="toggleLink" onclick="toggleExpand(this); return false;">Show more</a>

2 Answers, 1 is accepted

Sort by
0
Accepted
Cori
Top achievements
Rank 2
answered on 15 Nov 2010, 03:28 PM
Hello Mattias,

The reason it doesn't work is because you are trying to get the RadWIndowManager control, instead of the RadWindow the page is contained in. You need to add this method to get the RadWindow:

function GetRadWindow()
        {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        }

Then change your pageLoad function to something like this:

function pageLoad() {
   galleryWin = GetRadWindow(); 
}

Now the autoSize method call you make should work correctly.

I hope that helps.
0
Mattias Moberg
Top achievements
Rank 1
answered on 15 Nov 2010, 07:35 PM
Hi Cori.

Your solution did solve my problem.
Thanks alot for your time and your helping hand.
Tags
Window
Asked by
Mattias Moberg
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Mattias Moberg
Top achievements
Rank 1
Share this question
or