donna mcdaniel

donna mcdaniel

  • NA
  • 1
  • 16.4k

Modal PopUp Window containing User Control with UpdatePanel

Aug 18 2008 5:30 PM

I have a customer page which contains a button to add a new address.  When this button is clicked on, I open a modal window which has a user control.  The contents of the user control is listed below.  The user control has a drop down meu to list the countries.  If the user selects United States I show drop down list of all the states, otherwise if they select any other country then I show a text box for them to type in their region/province. I do this by setting the autopostback=true on the countryDropDownList and I call the onselectedindexchanged="countryDropDownList_SelectedIndexChanged".  I have the user control inside an update panel and it works fine until I put it in my modal window. Once it pops up in a model window and the user selects country the page refreshes and the model window disappears. I have tried putting update panels all over the place and I have no luck.  Any help would be appreciated.

<asp:UpdatePanel runat="server">
<
ContentTemplate>
<table>
   
<tr>
         
<td style="width: 20px"><asp:Label ID="contactTypeLabel" runat="server" Text="Label"></asp:Label></td>
         
<td style="width: 22px">&nbsp;</td>
         
<td style="width: 275px">&nbsp;</td>
         
<td style="width: 43px">&nbsp;</td>
         
<td style="width: 67px">&nbsp;</td>
         
<td class="style2">&nbsp;</td>
         
<td class="style1">&nbsp;</td>
</tr>
<tr>
   
<td style="width: 20px"><asp:CheckBox ID="primaryCheckBox" runat="server" /></td>
   
<td colspan="3">Primary Address&nbsp;</td>
   
<td style="width: 67px">&nbsp;</td>
   
<td class="style2">&nbsp;</td>
   
<td class="style1">&nbsp;</td>
</tr>

<tr>
<td style="width: 20px">&nbsp;</td>
<td style="width: 22px">Country</td>
<td colspan="2"><asp:DropDownList ID="countryDropDownList" runat="server"  DataValueField ="Country" DataTextField="Name" AutoPostBack="True"  onselectedindexchanged="countryDropDownList_SelectedIndexChanged"></asp:DropDownList></td>
<td style="width: 67px">&nbsp;</td>
<td class="style2">&nbsp;</td>
<td class="style1">&nbsp;</td>
</tr>
<tr>

<td style="width: 20px">&nbsp;</td>
<td style="width: 22px">Address:</td>
<td style="width: 275px"><asp:TextBox ID="Address1TextBox" runat="server" Text=""></asp:TextBox></td>
<td style="width: 43px">Type:</td>
<td style="width: 67px">
<asp:DropDownList ID="addressTypeDropDownList" runat="server">
<asp:ListItem>Select a Type</asp:ListItem>
<asp:ListItem Value="Home">Home</asp:ListItem>
<asp:ListItem Value="Work">Work</asp:ListItem>
</asp:DropDownList>
</td>
<td class="style2">&nbsp;</td>
<td class="style1"></td>
</tr>

<tr>

<td style="width: 20px"></td>

<td style="width: 22px">City:</td>

<td style="width: 275px"><asp:TextBox ID="cityTextBox" runat="server" Text=""></asp:TextBox></td>

<td style="width: 43px">State/Province:</td>

<td style="width: 67px">

<asp:TextBox ID="provinceTextBox" runat="server" Text="" Visible="false"></asp:TextBox>

<asp:DropDownList ID="stateDropDownList" runat="server" DataValueField ="State" DataTextField="Name">

</asp:DropDownList>

</td>

<td class="style2">&nbsp;Zip:</td>

<td class="style1"><asp:TextBox ID="zipTextBox" runat="server" Width="50px" Text=""></asp:TextBox></td>

</tr>

</table>

</ContentTemplate>

</asp:UpdatePanel>

 


Answers (1)