protected void ButtonSave_Click(object sender, EventArgs e)
{
if (MyCondition == true)
{
modalPopUpConfirmation.Show();
}
else
{
Label1.Text = "The condition was false, so no modal popup!";
}
}
Ajax ModalPopUp Window according to certain conditions
-
07-10-2022 - |
質問
I have a Ajax ModalPopupExtender in my page.On a button click currently using TargetControlId i am showing the pop up.My need is when i am clicking the button want to check some conditions from DB.If condition satisfies i want to show the pop up.Other wise no need of pop up.How can i do this?
<ajaxToolkit:ModalPopupExtender CancelControlID="btnCancel" BackgroundCssClass="modalBackground" runat="server" ID="PopupExtender" TargetControlID="btn" PopupControlID="Panel1"></ajaxToolkit:ModalPopupExtender>
解決
他のヒント
Try like this
protected void Button1_Click(object sender, EventArgs e)
{
PopupExtender.Show();
}
Call it dynamically.
<!-- Hidden Field -->
<asp:HiddenField ID="hidForModel" runat="server" />
<ajaxToolkit:ModalPopupExtender CancelControlID="btnCancel" BackgroundCssClass="modalBackground" runat="server" ID="PopupExtender" TargetControlID="hidForModel" PopupControlID="Panel1"></ajaxToolkit:ModalPopupExtender>
<asp:Button ID="btnShowPopup" runat="server" Text="Save Data"
OnClick="btnShowPopup_Click" />
Code Behind
protected void btnShowPopup_Click(object sender, EventArgs e)
{
if(Yourcondition)
{
PopupExtender.Show();
}
}
所属していません StackOverflow