Hi KurtJ,
Use AjaxControlToolkit ModalPopupExtender.
Check this example. Now please take its reference and correct your code.
HTML
<asp:TextBox runat="server" ID="txtCondition1" Text="false" />
<asp:TextBox runat="server" ID="txtCondition2" Text="true" />
<asp:Button Text="Save" runat="server" OnClick="ButtonSave_Click" />
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
<asp:LinkButton ID="lnkDummy" runat="server"></asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID="mpe" runat="server"
PopupControlID="pnlPopup" TargetControlID="lnkDummy" BackgroundCssClass="modalBackground"
CancelControlID="btnNo">
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
<div class="header">
</div>
<div class="body">
<asp:Label ID="lblMessage" runat="server" />
<br />
</div>
<div class="footer">
<asp:Button ID="btnYes" runat="server" Text="Yes" OnClick="OnYes" />
<asp:Button ID="btnNo" runat="server" Text="No" />
</div>
</asp:Panel>
Code
C#
public void ButtonSave_Click(object sender, EventArgs e)
{
lblMessage.Text = "";
bool Condition1 = Convert.ToBoolean(txtCondition1.Text);
bool Condition2 = Convert.ToBoolean(txtCondition2.Text);
if (Condition1 == false)
{
// Show confirm box "Accept condition 1?"
lblMessage.Text = "Accept condition 1?";
ModalPopupExtender1.Show();
}
if (Condition2 == false)
{
// Show confirm box "Accept Condition 2?"
lblMessage.Text = "Accept condition 2?";
ModalPopupExtender1.Show();
}
}
public void OnYes(object sender, EventArgs e)
{
// Do saving procedure
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('Record saved successfully')", true);
}
VB.Net
Public Sub ButtonSave_Click(ByVal sender As Object, ByVal e As EventArgs)
lblMessage.Text = ""
Dim Condition1 As Boolean = Convert.ToBoolean(txtCondition1.Text)
Dim Condition2 As Boolean = Convert.ToBoolean(txtCondition2.Text)
If Condition1 = False Then
' Show confirm box "Accept condition 1?"
lblMessage.Text = "Accept condition 1?"
ModalPopupExtender1.Show()
End If
If Condition2 = False Then
' Show confirm box "Accept condition 2?"
lblMessage.Text = "Accept condition 2?"
ModalPopupExtender1.Show()
End If
End Sub
Public Sub OnYes(ByVal sender As Object, ByVal e As EventArgs)
' Do saving procedure
ClientScript.RegisterClientScriptBlock(Me.GetType(), "", "alert('Record saved successfully')", True)
End Sub
Screenshot