Here is my code:
.modalBackground
{
background-color:Gray;
filter:alpha(opacity = 70);
opacity:0.7;
}
.panelStyle
{
background-color:White;
width:400px;
height:370px;
}
.okbtn
{
width:60px;
margin-top:5px;
text-align:left;
}
.closing
{
margin-left:150px;
}
.cncl
{
width: 65px;
}
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Label ID="Modpt" runat="server" ></asp:Label>
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Modpt" BackgroundCssClass="modalBackground" PopupControlID="div_Modal" />
<div id="div_Modal" class="panelStyle" style=" border: 4px solid; text-align: left; display:none;">
<div style="width:300px; margin-left:20px; margin-right:auto; padding-top:4px; padding-bottom:4px;">
<div style="background-color:#FFFFFF;width:368px; "></div>
<div style="background-color:#FFFFFF;width:368px; border-top: 1px solid #E3E3E3; ">
<div style="border-top: 1px solid #E3E3E3;">
<div style=" margin-top:10px; margin-bottom:10px; text-align:left;font-size:1.1em;">
<span id="IE8warn" style="display:none; font-size:1.1em; font-weight:bold; color:Red;">Note: You must select <b>"No"</b> to accept non-secure items in Internet Explorer 8</span><br />
<asp:Label ID="close" runat="server" Text="Uday" CssClass="closing"></asp:Label>
</div>
<div style=" border-top: 1px solid #E3E3E3;" >
<span style=" margin-left:300px;">
<asp:Button ID="ButtonOk" runat="server" Text="OK" CssClass="okbtn"/>
</span>
</div>
</div>
</div>
</div>
</div>
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
ModalPopupExtender1.Show()
End Sub
This is working fine. I mean the modal window is popping up every time I click the button. But I need to show the modal window only once. So, I had a count variable and when I use the 'If' statement with 'count = 0' as the condition, the modal window doesn't pop up. Can anyone please tell me if I am doing anything wrong here!!