Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hai i am Opening a Rad window in Page By Placing a Radwindow and Giving NavigateUrl and Redirect to another page and in that Pop only when i want to click the close button i need to close the Radwindow Please any one can help me in this 
Thanks in Advance i am Psoting my code here



In Parent.Aspx Page



XML
<telerik:RadWindowManager ID="RadWindowManger1" runat="server">
       <Windows>
           <telerik:RadWindow ID="RadWindow1" VisibleOnPageLoad="false" runat="server" EnableViewState="false"
               Behaviors="Close" VisibleStatusbar="false">
           </telerik:RadWindow>
       </Windows>
   </telerik:RadWindowManager>

XML
<telerik:RadButton ID="radBtnCreateIssue" runat="server" Text="Create New" AutoPostBack="true" CssClass="Button"
                       ButtonType="LinkButton" OnClick="radBtnCreateIssue_Click">
                   </telerik:RadButton>


in Parent.aspx.page.cs


C#
RadWindow1.NavigateUrl = "~/Public/Test.aspx?ButtonName=" + radBtnCreateIssue.Text + "&RadWindowName=RadWindow1";
            RadWindow1.VisibleStatusbar =false;
            RadWindow1.Width = 800;
            RadWindow1.Height = 650;
            RadWindow1.VisibleOnPageLoad = true;



in Popup.aspx


JavaScript
function CloseWindow() {
    if(GetRadWindow()!=null)
            GetRadWindow().close();
    }

    function GetRadWindow() {
        var oWindow = null;
        if (window.radwindow) {
            oWindow = window.radwindow;
        }
        else if (window.frameElement && window.frameElement.radwindow) {
            oWindow = window.frameElement.radwindow;
        }
        return oWindow;

    }



C#
<asp:Label ID="lblIssuType" Text="Issue Type" runat="server" CssClass="Label"></asp:Label>

<pre lang="c#"><telerik:RadTextBox ID="txtSummary"  runat="server" CssClass="TextBox" Resize="Both">
               </telerik:RadTextBox>


C#
<telerik:RadButton ID="IssueCancel" Text="Cancel" runat="server" OnClick="IssueCancel_Click">
                </telerik:RadButton>




in Popup.aspx.cs


C#
protected void IssueCancel_Click(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Close_btn", "<script language='javascript'>javascript:JustClose();</script>");
            
        }
Posted

change your code like below it'll work

In Parent.Aspx Page

XML
<asp:UpdatePanel ID="upEmployeeDetails" runat="server" UpdateMode="Conditional" RenderMode="Inline">
        <ContentTemplate>
            <telerik:RadWindow ID="RadWindow1" VisibleOnPageLoad="false" runat="server" EnableViewState="false"
               Behaviors="Close" VisibleStatusbar="false">
           </telerik:RadWindow>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="radBtnCreateIssue" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>


i haven't changed Parent.aspx.page.cs


in Popup.aspx

XML
<script type="text/javascript">
        function CloseWindow() {
            GetRadWindow().close();
        }

        function GetRadWindow() {
            var oWindow = null;
            if (window.radwindow) {
                oWindow = window.radwindow;
            }
            else if (window.frameElement.radwindow) {
                oWindow = window.frameElement.radwindow;
            }
            return oWindow;

        }
    </script>


in Popup.aspx.cs

protected void IssueCancel_Click(object sender, EventArgs e)
    {
        ScriptManager.RegisterStartupScript(this,this.GetType(), "closed", radPopupCloseScript("closed"),true);
    } 
private string radPopupCloseScript(string ActionName)
    {
        String script = @&quot;var oArg = new Object();
                    oArg.actionName = &#39;&quot; + ActionName + @&quot;&#39;;
                    var oWnd = GetRadWindow();
                    oWnd.Close(oArg);&quot;;
        return script;
    }


accept solution if it is useful
 
Share this answer
 
v3
Comments
Member 11040036 27-Aug-14 8:09am    
Thank you For Giving reply ClimerChinna still it is not closing and it displaying the Lines Of code below of that Button
ClimerChinna 27-Aug-14 8:12am    
have you added the code as it is, its working here try to trace the code as it is
Member 11040036 27-Aug-14 8:14am    
ya i added but it displaying the some text below of the Cancel Button
ClimerChinna 27-Aug-14 8:19am    
could you post your code once again so that i can correct it
Member 11040036 27-Aug-14 8:28am    
ya i submitted my question can u look into my code
in Parent.aspx
XML
<asp:UpdatePanel ID="upEmployeeDetails" runat="server" UpdateMode="Conditional" RenderMode="Inline">
    <ContentTemplate>
            <telerik:RadWindow ID="RadWindow1" VisibleOnPageLoad="false" runat="server" EnableViewState="false"
                Behaviors="Close" VisibleStatusbar="false">
            </telerik:RadWindow>
             </ContentTemplate>
              <Triggers>
            <asp:AsyncPostBackTrigger ControlID="radBtnCreateIssue" EventName="Click" />
        </Triggers>
     </asp:UpdatePanel>


XML
<telerik:RadButton ID="radBtnCreateIssue" runat="server" Text="Create New" AutoPostBack="true" CssClass="Button"
                      ButtonType="LinkButton" OnClick="radBtnCreateIssue_Click">
                  </telerik:RadButton>


In Parent.aspx.cs

C#
protected void radBtnCreateIssue_Click(object sender, EventArgs e)
       {
           RadWindow1.NavigateUrl = "~/Public/Test.aspx?ButtonName=" + radBtnCreateIssue.Text + "&RadWindowName=RadWindow1";
           RadWindow1.VisibleStatusbar =false;
           RadWindow1.Width = 800;
           RadWindow1.Height = 650;
           RadWindow1.VisibleOnPageLoad = true;
           

       }



in Popup.aspx



XML
<telerik:RadButton ID="IssueCancel" Text="Cancel" runat="server" OnClick="IssueCancel_Click" >
              </telerik:RadButton>



in Popup.aspx.cs


C#
protected void IssueCancel_Click(object sender, EventArgs e)
        {
            RadScriptManager.RegisterStartupScript(this, this.GetType(), "closed", radPopupCloseScript("closed"), true);
        }

        private string radPopupCloseScript(string ActionName)
        {
            String script = "<script type='text/javascript'> var oArg = new Object();oArg.actionName = '" + ActionName + "';var oWnd = GetRadWindow();oWnd.Close(oArg);</script>";
            return script;

        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900