In the code below; the "AutoPostBack" is set to true. When I select an item from the dropdown list; the popup window gets close automatically but returns the selected value. If I set "AutoPostBack" to false then it won't close popup but it will not return selected value.
What do I need to do so the popup won't close until I click on "Cancel" or "Search" button?
<cc1:modalpopupextender id="ModalPopupExtender1" runat="server"
OnOkScript="onModalOk();"
cancelcontrolid="btnCancel"
okcontrolid="BtnSubmit"
targetcontrolid="lnkBtn_AddFromdatabase"
popupcontrolid="panel1"
popupdraghandlecontrolid="PopupHeader" drag="true"
backgroundcssclass="ModalPopupBG"></cc1:modalpopupextender><asp:panel id="Panel1" style="display: none" runat="server"><div class="HellowWorldPopup"><div class="PopupHeader" id="PopupHeader">Database Search</div><div></div><br /><br /><div class="popup_Body" style="border:black 2px"><p>   Name:<asp:textbox id="txtName" runat="server"></asp:textbox></p><p>   <asp:Label ID="lblCompany" runat="server" Text="Company:"></asp:Label><asp:DropDownList ID="ddl_Company" runat="server" AutoPostBack="true" OnSelectedIndexChanged="OnSelectedIndexChanged_ddlCompany"></asp:DropDownList></p><p>   <asp:Label ID="lblID" runat="server" Text="ID:"></asp:Label><asp:DropDownList ID="ddl_Empployee" runat="server" AutoPostBack="true" OnSelectedIndexChanged="OnSelectedIndexChanged_ddlEmployee"></asp:DropDownList></p></div><br /><br /><div class="Controls" style="text-align:center"><input id="BtnSubmit" type="button" value="Search"/><input id="btnCancel" type="button" value="Cancel" /></div></div></asp:panel><style type="text/css">
.ModalPopupBG
{
background-color: #666699;
filter: alpha(opacity=50);
opacity: 0.7;
}
.AppPopup
{
min-width:400px;
min-height:275px;
background-color:lightsteelblue;
border-width: 3px;
border-style: solid;
border-color: white;
}
.popupBody
{
min-width:400px;
min-height:275px;
background-color:lightsteelblue;
border-width: 3px;
border-style: solid;
border-color: white;
}
.PopupHeader
{
background:green;
background-color:navy;
color:yellow;
}
</style> protected void OnSelectedIndexChanged_ddlCompany(object sender, EventArgs e)
{
string sSelectedValue = "Selected Item: " + ddl_Company.SelectedItem.Text;
ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", "alert('" + sSelectedValue + "');", true);
}