I have a multiselect listbox and a button in a panel that will popup clicking a textbox inside a modalpopup.
User will open the modalpopup and click on the textbox and that will open the panel with listbox and button. User will select one or more from the list and click the button to show the selection in the textbox. The process is fine upto this. The only problem is when the user clicks the button to select from the list, the selection shows in the textbox but the panel with list box appears again on top of the modal popup. If I click any where else it goes away. I want the panel with listbox will disappear when user clicks the button(btnEditZone) to add the selection.
Below is code snippet, the following thing is inside a panel with modalpopup.
<asp:TextBoxID="txtEditZone"runat="server"Text='<%# Bind("ZoningDist") %>'Width="350px"></asp:TextBox>
<asp:PanelID="pnlEditZone"runat="server"CssClass="modalPopup"style="display:none;"Width="120px"><asp:UpdatePanelID="upEditZone"runat="server"><ContentTemplate>
<asp:ListBoxID="lbEditZoDist"runat="server"DataSourceID="odsrcEditZoDist"DataTextField="ZoningDistricts"DataValueField="ZoningDistricts"Rows="10"SelectionMode="Multiple"Width="104px"></asp:ListBox>
<asp:ObjectDataSourceID="odsrcEditZoDist"runat="server"InsertMethod="Insert"OldValuesParameterFormatString="original_{0}"SelectMethod="GetZoningDistrict"TypeName="AppealsTableAdapters.tlkZoningDistTableAdapter"><InsertParameters><asp:ParameterName="ZoningDistricts"Type="String"/><asp:ParameterName="Sort"Type="Byte"/></InsertParameters></asp:ObjectDataSource></ContentTemplate></asp:UpdatePanel>
<asp:ButtonID="btnEditZone"runat="server"Text="Add"Width="67px"onclick="btnEditZone_Click"UseSubmitBehavior="False"/></asp:Panel>
<cc1:PopupControlExtenderID="pceEditZoDist"runat="server"CommitProperty="value"CommitScript="e.value;"PopupControlID="pnlEditZone"Position="Right"TargetControlID="txtEditZone"BehaviorID="bidEditZoDist"></cc1:PopupControlExtender>
Code behind: For the button btnEditZone:
Protected Sub btnEditZone_Click(ByVal sender AsObject,ByVal eAs System.EventArgs)
Dim myValuesAsString =String.Empty
Dim txtZoDistAs TextBox =CType(fvEditProperty.FindControl("txtEditZone"), TextBox)
Dim lbEditZoDistAs ListBox =CType(fvEditProperty.FindControl("lbEditZoDist"), ListBox)
ForEach itemAs ListItemIn lbEditZoDist.Items
If item.SelectedThenmyValues += ", "+ item.Text
EndIf
Next
If myValues.Length > 0Then
txtZoDist.Text = myValues.Substring(1)
EndIf
mpeEditProperty.Show()
EndSub