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

[Solved] Add window at runtime

8 Answers 205 Views
Window
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 07 Apr 2008, 09:15 AM
I use aradwindowManager on my page. In a "TextChanged" event I want to add a new window to the manager. I use follwing code in code behind:

                    objWindow = New RadWindow  
                    objWindow.ID = "rwSearchShiftNo" 
                    objWindow.OpenerElementID = "lnkSearchShiftno" 
                    objWindow.NavigateUrl = "search.aspx?searchtype=shiftno&show=yes" 
                    objWindow.ClientCallBackFunction = "SearchDialogCallBackFunction" 
                    rwmSearchDialog.Windows.Add(objWindow)  
 

The problem is that when I click nowe on the specified control defined in "OpenerElementId" nothing happens. What am I doing wrong?

8 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 07 Apr 2008, 03:03 PM
Hello Markus,

Make sure that the TextChanged event is fired - you can do this by putting a break point in debug mode. If you still experience problems, please open a support ticket and send us a sample project where the problem can be reproduced - we will check it and do our best to help.



Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 08 Apr 2008, 11:04 AM
Hello Georgi,

the Textchanged event is not the problem: Here is the complete code, just run the project and follow the instruction.

Aspx:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="logon.aspx.vb" Inherits="radWindowProblem.clspLogon" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
 
<head id="Head1" runat="server">  
    <title></title>  
</head> 
 
<body> 
    <form id="frmLogon" runat="server">  
        <telerik:RadScriptManager ID="smLogon" runat="server" EnableTheming="True"></telerik:RadScriptManager> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="rcboTest">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="rcboTest" /> 
                        <telerik:AjaxUpdatedControl ControlID="lnkSearchShiftno" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <Telerik:RadWindowManager id="rwmSearchDialog" runat="server" Skin="Office2007" VisibleStatusbar="False">  
            <Windows> 
            </Windows> 
        </Telerik:RadWindowManager> 
        <table> 
            <tr> 
                <td> 
                    Enter Text here to fire TextChanged  
                </td> 
                <td> 
                    <telerik:RadTextBox ID="rcboTest" runat="server" AutoPostBack="true">  
                    </telerik:RadTextBox> 
                </td> 
                <td> 
                    <asp:LinkButton id="lnkSearchShiftno" runat="server" Visible="false">Click here to open radWindow</asp:LinkButton> 
                </td> 
            </tr> 
        </table> 
    </form> 
</body> 
</html> 

Code behind:
Imports Telerik.Web.UI  
 
Partial Public Class clspLogon  
 
    Inherits System.Web.UI.Page  
 
    Private Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
 
    End Sub 
 
    Private Sub rcboTest_TextChanged(ByVal sender As ObjectByVal e As System.EventArgs) Handles rcboTest.TextChanged  
 
        Dim objWindow As RadWindow  
 
        lnkSearchShiftno.Visible = True 
 
        objWindow = New RadWindow  
        objWindow.ID = "rwSearchShiftNo" 
        objWindow.OpenerElementID = "lnkSearchShiftno" 
        objWindow.NavigateUrl = "search.aspx" 
        rwmSearchDialog.Windows.Add(objWindow)  
        'With this line in ASPX it works:  
        '<Telerik:RadWindow ID="rwSearchShiftNo" runat="server" OpenerElementID="lnkSearchShiftno" Behavior="Resize, Close, Move" NavigateUrl="search.aspx?searchtype=shiftno&show=yes" Left="" Top="" style="display:none;" Animation="None" Behaviors="Resize, Close, Move" InitialBehavior="None" InitialBehaviors="None" ReloadOnShow="True" VisibleStatusbar="False" Modal="True" Height="500px" Width="620px"></Telerik:RadWindow>  
 
    End Sub 
 
End Class 
0
Markus
Top achievements
Rank 1
answered on 08 Apr 2008, 11:04 AM
Hello Georgi,

the Textchanged event is not the problem: Here is the complete code, just run the project and follow the instruction.

Aspx:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="logon.aspx.vb" Inherits="radWindowProblem.clspLogon" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
 
<head id="Head1" runat="server">  
    <title></title>  
</head> 
 
<body> 
    <form id="frmLogon" runat="server">  
        <telerik:RadScriptManager ID="smLogon" runat="server" EnableTheming="True"></telerik:RadScriptManager> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="rcboTest">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="rcboTest" /> 
                        <telerik:AjaxUpdatedControl ControlID="lnkSearchShiftno" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <Telerik:RadWindowManager id="rwmSearchDialog" runat="server" Skin="Office2007" VisibleStatusbar="False">  
            <Windows> 
            </Windows> 
        </Telerik:RadWindowManager> 
        <table> 
            <tr> 
                <td> 
                    Enter Text here to fire TextChanged  
                </td> 
                <td> 
                    <telerik:RadTextBox ID="rcboTest" runat="server" AutoPostBack="true">  
                    </telerik:RadTextBox> 
                </td> 
                <td> 
                    <asp:LinkButton id="lnkSearchShiftno" runat="server" Visible="false">Click here to open radWindow</asp:LinkButton> 
                </td> 
            </tr> 
        </table> 
    </form> 
</body> 
</html> 

Code behind:
Imports Telerik.Web.UI  
 
Partial Public Class clspLogon  
 
    Inherits System.Web.UI.Page  
 
    Private Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
 
    End Sub 
 
    Private Sub rcboTest_TextChanged(ByVal sender As ObjectByVal e As System.EventArgs) Handles rcboTest.TextChanged  
 
        Dim objWindow As RadWindow  
 
        lnkSearchShiftno.Visible = True 
 
        objWindow = New RadWindow  
        objWindow.ID = "rwSearchShiftNo" 
        objWindow.OpenerElementID = "lnkSearchShiftno" 
        objWindow.NavigateUrl = "search.aspx" 
        rwmSearchDialog.Windows.Add(objWindow)  
        'With this line in ASPX it works:  
        '<Telerik:RadWindow ID="rwSearchShiftNo" runat="server" OpenerElementID="lnkSearchShiftno" Behavior="Resize, Close, Move" NavigateUrl="search.aspx?searchtype=shiftno&show=yes" Left="" Top="" style="display:none;" Animation="None" Behaviors="Resize, Close, Move" InitialBehavior="None" InitialBehaviors="None" ReloadOnShow="True" VisibleStatusbar="False" Modal="True" Height="500px" Width="620px"></Telerik:RadWindow>  
 
    End Sub 
 
End Class 
0
Georgi Tunev
Telerik team
answered on 08 Apr 2008, 11:27 AM
Hi Markus,

You are adding the RadWindow to the RadWindowManager's Windows collection, however you are using Ajax and you don't update the manager itself - that is the reason for the problem. If you add the RadWindowManager to the updated controls' collection, the window will be shown.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">   
    <AjaxSettings>  
        <telerik:AjaxSetting AjaxControlID="rcboTest">   
            <UpdatedControls>  
                <telerik:AjaxUpdatedControl ControlID="rcboTest" />  
                <telerik:AjaxUpdatedControl ControlID="lnkSearchShiftno" />  
                <telerik:AjaxUpdatedControl ControlID="rwmSearchDialog" />  
            </UpdatedControls>  
        </telerik:AjaxSetting>  
    </AjaxSettings>  
</telerik:RadAjaxManager>  


Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 08 Apr 2008, 11:36 AM
Thanks it is working now, but after the first Ajax refresh I have now an empty border on top of page. How can I avoid this?
0
Accepted
Georgi Tunev
Telerik team
answered on 14 Apr 2008, 11:17 AM
Hello Markus,

This is due to the way the Ajax update panel works. What you can do is to hook to the RadAjaxManager's AjaxSettingCreating event and set the render mode of the panel to Inline:


Protected Sub RadAjaxManager1_AjaxSettingCreating(ByVal sender As ObjectByVal e As Telerik.Web.UI.AjaxSettingCreatingEventArgs) Handles RadAjaxManager1.AjaxSettingCreating 
   e.UpdatePanel.RenderMode = UpdatePanelRenderMode.Inline 
End Sub 




Greetings,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 15 Apr 2008, 08:36 AM
Now it is working. Thanks!
0
Markus
Top achievements
Rank 1
answered on 15 Apr 2008, 08:36 AM
Now it is working. Thanks!
Tags
Window
Asked by
Markus
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Markus
Top achievements
Rank 1
Share this question
or