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

change window height from code behind

2 Answers 85 Views
Window
This is a migrated thread and some comments may be shown as answers.
Clive Hoggar
Top achievements
Rank 1
Clive Hoggar asked on 26 Feb 2009, 07:13 PM
Hi

I have put a radajaxpanel in the window content that opens when
a check box is checked to display more items in a form.  

This adds height to the page and creates the need for scroll bars
(which appear) but I would prefer to automatically extend the height
of the window to accomodate the additional form items.
How can I do this from the code behind in the same sub that makes the
panel visible? (VB)

I am sure it is easy .. but I just can't figure it out.

I have tried this - but it does nothing - maybe because the window is not updated
at that point?
Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged  
        If CheckBox1.Checked Then  
            RadAjaxPanel1.Visible = True 
            Dim RadWindow1 As New RadWindow  
            RadWindow1.Height = Unit.Pixel(450)  
        Else  
            RadAjaxPanel1.Visible = False 
        End If  
    End Sub 
thanks

Clive

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 Feb 2009, 07:55 AM

Hello Clive Hoggar,

I am not sure that where you placed the RadAjaxPanel, whether in RadWindow or in the parent page. I tried the code snippet below in order to show the RadWindow according to desired height.

VB:

Protected Sub CheckBox1_CheckedChanged(ByVal sender As ObjectByVal e As EventArgs)  
    If CheckBox1.Checked Then 
        '   RadAjaxPanel1.Visible = true;  
        Dim newWindow As New Telerik.Web.UI.RadWindow()  
        newWindow.NavigateUrl = "Window1.aspx" 
        newWindow.Height = Unit.Pixel(450)  
        newWindow.VisibleOnPageLoad = True 
        form1.Controls.Add(newWindow)  
          
    Else 
        '    RadAjaxPanel1.Visible = false;  
    End If 
End Sub 

Thanks,
Princy.
0
Georgi Tunev
Telerik team
answered on 27 Feb 2009, 11:06 AM
Hi Clive Hoggar,

Once the RadWindow is created on the client you can change its dimensions by using the client-side API (setSize()). If you want to do that from the server, you will need to close and recreate the RadWindow every time.

Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Window
Asked by
Clive Hoggar
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Georgi Tunev
Telerik team
Share this question
or