I want to add a confirmation window. The following code shows a yes / no confirmation window, but it does not care about verification. If I made the company name field mandatory, it enters the entry, even if I did not enter the company name.
I called this method in the pageload event:
CreateConfirmBox(btnAddEnquiry, "Do You Really Want to Add ?");
Method Definitions:
public void CreateConfirmBox(System.Web.UI.WebControls.Button btn, string strMessage) { btn.Attributes.Add("OnClick", "return confirm('" + strMessage + "');"); }
aspx file
<asp:Button ID="btnAddEnquiry" runat="server" BackColor="#0000FF" ForeColor="LightSlateGray" OnClick="btnAddEnquiry_Click" Text="Add Enquiry" Width="154px" />
source share