我已經在網上進行了搜索,並嘗試了一些提供的解決方案,但沒有一個適合我。無法在jQuery對話框中點擊一個asp.net按鈕
我有一個div內的按鈕。我在jQuery對話框中顯示div。按鈕單擊不在jQuery對話框中工作。
我有我的代碼如下:
ASPX
<div id='one'>
<asp:LinkButton ID="ConfigureAlerts" OnClick="btnConfigureAlerts_Click" runat="server">Configure Alerts</asp:LinkButton>
</div>
<div id="ViewModalPopupDiv2">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel2" runat="server" HorizontalAlign="left" ScrollBars="Auto">
<asp:Button ID="btnGetLogs" runat="server" Text="SendAlerts" OnClick="btnSendAlertEmail_Click"/>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
jQuery的
function ViewModelPopup2() {
$("#ViewModalPopupDiv2").dialog({
scrollable: true,
width: 800,
modal: true
});
}
aspx.cs
protected void btnSendAlertEmail_Click(object sender, EventArgs e)
{
// Code to send email
}
protected void btnConfigureAlerts_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript
(this, this.GetType(), "callScriptFunction", "ViewModelPopup2();", true);
}
}
請讓我知道我需要做的,觸發服務器控制ol事件。
應該不是你的onClick事件有btnConfigureAlerts_Click()?爲什麼不只是使用正常的HTML按鈕,如果你只是要調用JavaScript函數? –
我相信她想要從jQuery對話框中的按鈕後面觸發代碼。我認爲你的按鈕ID需要是「btnConfigureAlerts」。 – ElliotM
檢查您的控制檯是否有javascript錯誤。 –