如何关闭Rad窗口 [英] How to Close a Rad Window

查看:77
本文介绍了如何关闭Rad窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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










<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>




<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







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







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;

    }










<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>







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













in Popup.aspx.cs







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

推荐答案

改变你的代码如下工作



在Parent.Aspx页面



change your code like below it'll work

In Parent.Aspx Page

<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没有改变Parent.aspx.page.cs










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


in Popup.aspx

<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





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

在Parent.aspx中的




in Parent.aspx
<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>







<telerik:RadButton ID="radBtnCreateIssue" runat="server" Text="Create New" AutoPostBack="true" CssClass="Button"

                      ButtonType="LinkButton" OnClick="radBtnCreateIssue_Click">
                  </telerik:RadButton>





在Parent.aspx.cs





In Parent.aspx.cs

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










in Popup.aspx



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







in Popup.aspx.cs








in Popup.aspx.cs


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;

        }


这篇关于如何关闭Rad窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆