I have a web page having asp.net button control and textbox. I want a confirm message box, when someone changes the content of textbox and click on button. If user click on yes then event of button should fire other wise nothing should happen. All I want is to implement AJAX call back, but it is not working with ASP.NET button control.
我有一个网页有asp.net按钮控件和文本框。我想要一个确认消息框,当有人更改文本框的内容并单击按钮时。如果用户单击是,则按钮事件应该触发其他任何应该发生的事情。我想要的只是实现AJAX回调,但它不能与ASP.NET按钮控件一起使用。
5 个解决方案
#1
1
Just add the following code to your aspx code
只需将以下代码添加到您的aspx代码中即可
<asp:Button ID="btn1" OnClientClick="return confirm('sure?');" runat="server" Text="Button" />
#2
0
You can use the ConfirmButtonExtender of the AjaxControlToolkit for this purpose,
您可以使用AjaxControlToolkit的ConfirmButtonExtender来实现此目的,
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ConfirmButton/ConfirmButton.aspx
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ConfirmButton/ConfirmButton.aspx
#3
0
You can also do using Client Callback
in ASP.Net, It is really nice feature in ASP.Net
您也可以在ASP.Net中使用客户端回调,这在ASP.Net中非常好用
#4
0
Please refer to http://msdn.microsoft.com/en-us/library/ms178208.aspx. Hope it helps :)
请参阅http://msdn.microsoft.com/en-us/library/ms178208.aspx。希望能帮助到你 :)
#5
0
Combining the use of OnClientClick with javascript's confirm as suggested by Pilgerstorfer Franz, with an update panel for the ajax request you mentioned...
根据Pilgerstorfer Franz的建议,结合使用OnClientClick和javascript的确认,以及您提到的ajax请求的更新面板......
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:TextBox ID="txtInput" runat="server"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="btnSubmit" OnClientClick="return confirm('Are you sure you want to submit?');" runat="server" Text="Submit" />
Should give you want you need.
应该给你想要的。
#1
1
Just add the following code to your aspx code
只需将以下代码添加到您的aspx代码中即可
<asp:Button ID="btn1" OnClientClick="return confirm('sure?');" runat="server" Text="Button" />
#2
0
You can use the ConfirmButtonExtender of the AjaxControlToolkit for this purpose,
您可以使用AjaxControlToolkit的ConfirmButtonExtender来实现此目的,
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ConfirmButton/ConfirmButton.aspx
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ConfirmButton/ConfirmButton.aspx
#3
0
You can also do using Client Callback
in ASP.Net, It is really nice feature in ASP.Net
您也可以在ASP.Net中使用客户端回调,这在ASP.Net中非常好用
#4
0
Please refer to http://msdn.microsoft.com/en-us/library/ms178208.aspx. Hope it helps :)
请参阅http://msdn.microsoft.com/en-us/library/ms178208.aspx。希望能帮助到你 :)
#5
0
Combining the use of OnClientClick with javascript's confirm as suggested by Pilgerstorfer Franz, with an update panel for the ajax request you mentioned...
根据Pilgerstorfer Franz的建议,结合使用OnClientClick和javascript的确认,以及您提到的ajax请求的更新面板......
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:TextBox ID="txtInput" runat="server"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="btnSubmit" OnClientClick="return confirm('Are you sure you want to submit?');" runat="server" Text="Submit" />
Should give you want you need.
应该给你想要的。