2017-08-02 43 views
0

我在每個頁面都有一個彈出的radwindow。我想使用裏面的關閉按鈕關閉彈出窗口。我已經通過網絡搜索,但沒有得到任何好運。誰能幫我?使用裏面的按鈕關閉radwindow

這裏是我的代碼: Mainpage.aspx

<%@ Register TagPrefix="uc" TagName="ReportDialog" Src="~/WebUserControl/ReportDialog.ascx" %> 
<telerik:RadWindow ID="RadWindowReportDialog" runat="server" VisibleTitlebar="true" 
    Title="Report" VisibleStatusbar="false" Width="415px" Height="355px" ReloadOnShow="true" 
    ShowContentDuringLoad="true" Behaviors="Move, Close" Modal="true" OnClientBeforeClose="RadWindowReportDialog_OnClientBeforeClose"> 
    <ContentTemplate> 
     <uc:ReportDialog ID="ReportDialog" runat="server" /> 
    </ContentTemplate> 
</telerik:RadWindow> 

ReportDialog.ascx

<telerik:RadButton ID="btnClose" runat="server" CssClass="rbutton" OnClick="btnClose_Click" 
          Text="Close" Width="90px" OnClientLoad="btnClose_OnClientLoad" > 
          <Icon PrimaryIconUrl="../Image/Close.png" PrimaryIconLeft="4" PrimaryIconTop="4" /> 
         </telerik:RadButton> 

回答

1

ASCX

<telerik:RadButton ID="btnClose" runat="server" CssClass="rbutton" OnClick="btnClose_Click" 
          Text="Close" Width="90px" OnClientLoad="btnClose_OnClientLoad" > 
          <Icon PrimaryIconUrl="../Image/Close.png" PrimaryIconLeft="4" PrimaryIconTop="4" OnClientClicked="OnClientClicked"/> 
         </telerik:RadButton> 

JS

<script type="text/javascript"> 
    function OnClientClicked(sender, args) { 
     var window= $find('<%=RadWindowReportDialog.ClientID %>'); 
     window.close(); 
    } 
</script> 
+0

我試過上面的代碼,但我得到了這個錯誤編譯器錯誤消息:CS0103:名稱'RadWindowReportDialog'在當前上下文中不存在 – geekypanda