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

RadAjadPanel and Window

2 Answers 156 Views
Window
This is a migrated thread and some comments may be shown as answers.
vn
Top achievements
Rank 1
vn asked on 19 May 2008, 04:37 AM
Hi,

I have a page contains a RadAjaxPanel and a RadWindowManager.  The RadAjaxPanel contains a button (call Edit) to open a modal window to allow user to edit some data.  I want the RadAjaxPanel to refresh after the user click on the save button in the popup window.

I have three problems:
  1. When I click on the Edit button, the RadAjaxPanel always refresh before showing the window.  How can I prevent this?
  2. I cannot re-open the popup window anymore by clicking on the Edit button after I close the previous popup window (either by click the Save button or the X button).
  3. If I put the RadWindowManager inside the RadAjaxPanel then the popup window automatically closed right after click on the Edit button.

Thank you,

Vincent

Parent Page:

<script type="text/javascript" language="javascript">
function
CallBackFunction(radWindow, returnValue)
{
    var ajaxPanel = $find( "<%=rapPanel.ClientID %>" );
    ajaxPanel.ajaxRequest(
"");
}
</script>

<
asp:ScriptManager runat="server" ID="scriptMgr" />
<telerik:RadAjaxPanel runat="server" ID="rapPanel">
        <asp:TextBox ID="txt1" runat="server" />
        
<asp:Button ID="btnEdit" runat="server" Text="Edit" />
</telerik:RadAjaxPanel>

<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    
<Windows>
        
<telerik:RadWindow ID="radWin1" runat="server" 
                
OpenerElementID="<%#btnEdit.ClientID %>"
                NavigateUrl="~/Popup.aspx" 
 
                
Modal="true" ReloadOnShow="true"
                
ClientCallBackFunction="CallBackFunction">
        
</telerik:RadWindow>
    
</Windows>
</telerik:RadWindowManager>


==========================================
Popup.aspx

<

script type="text/javascript" language="javascript">
function
GetRadWindow()
{
    var oWindow = null;
    if (window.radWindow) 
        oWindow = window.radWindow;
    else if (window.frameElement.radWindow) 
        oWindow =  window.frameElement.radWindow;
    return oWindow;
}

</script>

<
asp:TextBox ID="txt1" runat="server" />
<asp:TextBox ID="TextBox1" runat="server" />
<br />
<asp:Button ID="btnOK" Text="Save" runat="server" onclick="btnOK_Click" />
<asp:Button ID="btnCancel" Text="Cancel" runat="server" OnClientClick="GetRadWindow().close(); return false;" />

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 19 May 2008, 01:59 PM
Hi Vincent,

The reason for the problem is that you are using the OpenerElementID property. I strongly recommend not to use the OpenerElementId property in such scenario - it is intended to be used in simple cases only when you want to open a RadWindow popup by clicking on some element.
When there is a more complex logic however, you need to use either the Client-Side or the Server-Side API for opening the RadWindow.

More information on how to set various server and client side properties is available in the documentation, section Controls / RadWindow / Programming.

Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
vn
Top achievements
Rank 1
answered on 19 May 2008, 04:06 PM
Thank you, Georgi  for the quick response.

Your suggestion works great.

1) I created a javascript function as follow:
function OpenWindow()  
{  
    var win = $find("<%= radWin1.ClientID %>");  
    win.show();  

2) remove the OpenerElementID="<%#btnEdit.ClientID %>" from the RadWindow

3) Add the following to the to the btnEdit button    
    OnClientClick="OpenWindow(); return false;"

Vincent
Tags
Window
Asked by
vn
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
vn
Top achievements
Rank 1
Share this question
or