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

Set Behaviors client side

4 Answers 554 Views
Window
This is a migrated thread and some comments may be shown as answers.
Michael Hanson
Top achievements
Rank 1
Michael Hanson asked on 02 Dec 2007, 04:29 PM
I am creating my windows in client side code.  I have found the set_Behaviors method on the RadWindow via debugging and tried to call this with a string corresponding to the Enum used server side but nothing happens.

How do I set my windows in script so that they only show the Close button?

4 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 03 Dec 2007, 07:34 AM
Hi Michael Hanson,

You cannot set the behavior of a RadWindow with Javascript - you will need to declare a RadWindow in your page with the appropriate values in the Behaviors enum and open this RadWindow.




Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael Hanson
Top achievements
Rank 1
answered on 03 Dec 2007, 08:04 AM
Thanks for the response.

I tried what you propose and kept getting javascript errors, which was what led me to find the  set_Behaviors method.

I have it covered for now by relying on the default behaviors of the WindowManager but I will try again and let you know what the error is.

Mike
0
Georgi Tunev
Telerik team
answered on 03 Dec 2007, 12:32 PM
Hello again Mike,

First of all I would like to apologize for my mistake - I was under the impression that we are talking about the ASP.NET version of the control, not the Prometheus one. I apologize for the misunderstanding.

You can set the behaviors property on the client in the "Prometheus" version by using the following syntax:
<form id="form1" runat="server">  
 
    <script type="text/javascript">  
    function openAndSet()  
    {  
        var oWnd = radopen("http://www.google.com", "RadWindow1");  
        oWnd.set_Behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize +Telerik.Web.UI.WindowBehaviors.Close);  
        oWnd.center();  
    }  
 
    </script> 
 
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">  
    </telerik:RadWindowManager> 
    <button onclick="openAndSet(); return false;">  
        Open RadWindow</button> 
</form> 

Note the center() method that is called after that. This is because when a RadWindow is initially shown the width of the titlebar's text is calculated with the titlebar buttons included. After that, when you remove the buttons by using the set_Behaviors() method, the size should be re-calculated again - otherwise the buttons will not be positioned correctly. To do this, the easiest way would be to center / move / resize the dialog.

I hope this helps. Once again - sorry for the misunderstanding.


Regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Michael Hanson
Top achievements
Rank 1
answered on 03 Dec 2007, 01:01 PM
Excellent, that is exactly what I needed to know.

Thanks very much.
Tags
Window
Asked by
Michael Hanson
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Michael Hanson
Top achievements
Rank 1
Share this question
or