我在page1.ascx内部有一个模态,需要在单击page2.ascx的跨度单击时调用它。我无法使其工作。请帮忙。
Page2.ascx
<ul class="nav metismenu" id="side-menu">
<li id="nav_callback" runat="server">
<a><i class="fa fa-phone"></i> <span class="nav-label spmodal" onclick="open_request_callback()">Request Callback</span></a>
</li>
</ul>
Page2.ascx(JS函数)
function open_request_callback() {
$get("<%=btn_open_request_callback.ClientID %>").click();
}
Page2.ascx(asp:按钮单击):
<div class="hidden">
<asp:Button ID="btn_open_request_callback" runat="server" OnClick="btn_open_request_callback_Click" />
</div>
<telerik:RadAjaxManagerProxy ID="ram" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btn_open_request_callback">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="btn_open_request_callback" UpdatePanelRenderMode="Inline"/>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
Page2.ascx(隐藏代码):
protected void btn_open_request_callback_Click(object sender, EventArgs e)
{
request_callback callback = new request_callback();
callback.open_callback_model();
}
Page1.ascx(后面的代码):-未调用Javascript函数
public void open_callback_model()
{
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "open_callback_modal", "open_callback_modal();", true);
}
Page1.ascx(JS函数)
function open_callback_modal() {
alert('You clicked the button!')
$get("btn_open_callback").click();
}
Page1.ascx(点击一次):
<span id="btn_open_callback" data-toggle="modal" data-target="#mdl_request_callback"></span>
答案 0 :(得分:0)
需要注册控件:
<%@ Register Src="~/controls/request_callback.ascx" TagPrefix="uc1" TagName="request_callback" %>
<uc1:request_callback runat="server" id="request_callback" />