我在每个页面都有一个弹出式窗口。我想用里面的关闭按钮关闭弹出窗口。我在网上搜索过但没有运气。任何人都可以帮助我吗?
这是我的代码: 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>
答案 0 :(得分: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>