mike55 Posted August 9, 2005 Posted August 9, 2005 Hi, Have a checkbox on my form, that has the postback enabled. What I would like to do is to display a confirm dialog asking the user are they sure they want to do this if the checkbox is checked true. If they click ok, then that no problem, however if they check cancel, I want to reset the checkbox back to its previous value. The approach that I am using to display message dialogues and confirm dialogues is as follows: 1. I add the following between the </form> and </body> tags <script> <asp:Literal id="ltlAlert" runat="server" EnableViewState="False"> </asp:Literal> </script> 2. I add a withEvent declaration into the form design section of the code-behind page. Protected WithEvents ltlAlert As System.Web.UI.WebControls.Literal 3. I then declare a method to handle the displaying of the message dialogues Private Sub DisplayMessage(ByVal Message As String, Optional ByVal operator As Int16 = 1) Message = Message.Replace("'", "\'") Message = Message.Replace(Convert.ToChar(10), "\n") Message = Message.Replace(Convert.ToChar(13), "") ' Display as JavaScript alert Select Case operator Case 1 ltlAlert.Text = "alert('" & Message & "')" Case 2 ltlAlert.Text = "confirm('" & Message & "')" End Select End Sub Any suggests?? Mike55. Quote A Client refers to the person who incurs the development cost. A Customer refers to the person that pays to use the product. ------ My software never has bugs. It just develops random features. (Mosabama vbforums.com)
eramgarden Posted August 9, 2005 Posted August 9, 2005 I do that with Javascript: http://www.ondotnet.com/pub/a/dotnet/2003/09/15/aspnet.html http://www.syncfusion.com/FAQ/aspnet/WEB_c15c.aspx#q221q Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.