Adjusting RadWindow size on client action issues

2 posts, 0 answers
  1. Sean
    Sean avatar
    200 posts
    Member since:
    Nov 2010

    Posted 29 Mar 2011 Link to this post

    Hi Telerik,

    I have a RadWindow of a certain size. When the RadWindow is first loaded I call AdjustRadWindow to set the window size. In addition, the window adjusts fine on a RadDateTimePicker's OnPopupOpening and OnPopupClosing events.

    I am struggling to get this to work when the user interacts with a RadComboBox. The RadComboBox hides elements on the RadWindow and I would like to resize the window after they're hidden.

    protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    private void SetWindowState(string currentSelection)
        if (string.Compare(currentSelection, Charts.LineChart.ToString()) == 0)
            RadDateTimePicker2.Visible = true;
            Label2.Visible = true;
            CheckBox3.Visible = true;
        else if (string.Compare(currentSelection, Charts.PieChart.ToString()) == 0)
            RadDateTimePicker2.Visible = false;
            Label2.Visible = false;
            CheckBox3.Visible = false;
            Debug.Assert(false, "Unhandled chart type in RadSettings");
    function OnClientSelectedIndexChanged(sender, eventArgs) {
        setTimeout(function () { AdjustRadWindow(); }, 500);

    function AdjustRadWindow() {
        var oWindow = GetRadWindow();
        setTimeout(function () { oWindow.autoSize(true); if ($telerik.isChrome || $telerik.isSafari) ChromeSafariFix(oWindow); }, 500);
    //fix for Chrome/Safari due to absolute positioned popup not counted as part of the content page layout
    function ChromeSafariFix(oWindow) {
        var iframe = oWindow.get_contentFrame();
        var body = iframe.contentWindow.document.body;
        setTimeout(function () {
            var height = body.scrollHeight;
            var width = body.scrollWidth;
            var iframeBounds = $telerik.getBounds(iframe);
            var heightDelta = height - iframeBounds.height;
            var widthDelta = width - iframeBounds.width;
            if (heightDelta > 0) oWindow.set_height(oWindow.get_height() + heightDelta);
            if (widthDelta > 0) oWindow.set_width(oWindow.get_width() + widthDelta);
        }, 310);

    If I place an alert inside of OnClientSelectedIndexChanged then, after I close the alert, AdjustRadWindow seems to work properly. The problem is that the controls aren't disappearing fast enough from the screen, even with two time-outs.

    I believe the issue may be related to this --

    Any suggestions? Solutions?



  2. Marin Bratanov
    Marin Bratanov avatar
    3899 posts

    Posted 31 Mar 2011 Link to this post

    Hi Sean,

    Based on the provided information I cannot replicate your scenario. I can only be guessing but please check if a postback occurs after a click on the combobox. If it does it is possible that the alert blocks it so you see the changes, but then the page postbacks and the window resets.
    If this does not help you solve the issue please send us a fully runnable project that displays this behavior so we can debug it locally and pinpoint the issue.

    the Telerik team
Back to Top