Click here to Skip to main content
15,905,414 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have four listbox some categories for ex otomobile->opel->astra->1.6 etc.
every selection has listbox and changes listbox select index changing event.
first select main categories = otomobile or housing or jobs etc.
if select main categories I will load usercontrol because every main categories usercontrols different.

for ex I selected otomobile category otomobile usercontrol dynamically load inside contentplaceholder panel.

C#
Control login = LoadControl("UsrCntrl/otomobile.ascx");


                if (Session["xxx"] != null)
                {


                    Panel1.Controls.Add(login);


                }


these also source code

XML
<asp:Content ID="Content6" ContentPlaceHolderID="CntHeader" runat="server">

         <div class="product-filter">
         <div class="display">Kategori Seç</div>
          </div>

          <table style="width: 100%">
                     <tr>
                         <td>
                          <asp:ListBox ID="ListBox1" runat="server" Height="150px" Width="200px" AutoPostBack="True"
                                onselectedindexchanged="ListBox1_SelectedIndexChanged"></asp:ListBox>

                         </td>
                         <td>
                          <asp:ListBox ID="ListBox2" runat="server" Height="150px" Width="200px"
                                AutoPostBack="True" onselectedindexchanged="ListBox2_SelectedIndexChanged"></asp:ListBox>

                         </td>
                         <td>


                          <asp:ListBox ID="ListBox3" runat="server" Height="150px" Width="200px"
                                 AutoPostBack="True" onselectedindexchanged="ListBox3_SelectedIndexChanged" ></asp:ListBox>

                           </td>
                            <td>

                            <asp:ListBox ID="ListBox4" runat="server" Height="150px" Width="200px"
                                    AutoPostBack="True" onselectedindexchanged="ListBox4_SelectedIndexChanged" ></asp:ListBox>


                         </td>
                         <td>
                             &nbsp;</td>
                         <td>
                             &nbsp;</td>
                     </tr>
          </table>
</asp:Content>

<asp:Content ID="Content7" ContentPlaceHolderID="CntIcerik" runat="server">


    <asp:Panel ID="Panel1" runat="server">
    </asp:Panel>








</asp:Content>



otomobile usercontrol has a country dropdownlist autopostback true
if I change data from dropdownlist another dropdownlist fill cities
for ex I select germany another dropdown fill cities frankfurt,bochum etc.

this is the problem here,if I select country page postback running so usercontrol lost.

how can I fix this problem?
Posted
Comments
Kornfeld Eliyahu Peter 26-Jan-15 7:48am    
Dynamic controls have to be re-created on every postback too...
Member-2338430 26-Jan-15 8:29am    
but I want to load usercontrol listbox4 selectindexchange event not page load I dont understad

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900