I am trying to implement modalpopupextender but now problem is that panel is visible in both condition. but my target is that when modalpopupextender visible when condition true. I am trying in this way.
protected void btn_mark_favorite_Click(object sender, EventArgs e)
{
try
{
if (UserID != 0)
{
ModalPopupExtender2.Show();
Panel1.Visible = false;
}
else
{
Response.Redirect("Home.aspx");
ModalPopupExtender2.Show();
}
}
catch (Exception ex)
{ }
}<asp:ModalPopupExtender ID="ModalPopupExtender2" TargetControlID="btn_mark_favorite" runat="server" PopupControlID="Panel1" BackgroundCssClass="modalBackground" CancelControlID="btn_cancle_2"></asp:ModalPopupExtender><asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" style = "display:none"><br /><p>Login first then try to favorite!</p><asp:Button ID="btn_cancle_2" runat="server" Text="Cancle" BackColor="#0066ff" ForeColor="White" Font-Bold="true" Font-Names="Tahoma" Height="25" Width="70" BorderStyle="None" OnClick="btn_cancle_2_Click" /></asp:Panel>