Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all, I'm facing a problem that I can't solve with hours of research!

I really need your help...

I want to postback my page to content fields on my page get filled when I select an item of my dropdownlist that is filled when I click on a button...

Inside the contents of the UpdatePanel I have the dropdownlist and the button to fill dropdownlist... Everything goes fine when i click the button... But the problem is when i click on an item of my dropdownlist don't postback (refresh whole page)..

Where is my code.

ASP.NET
   <asp:ScriptManager ID="ScriptManager1" runat="server">
      </asp:ScriptManager> 

    <div>


<asp:UpdatePanel ID="PleaseWaitPanel" runat="server" RenderMode="Inline">
                <ContentTemplate>

                        <asp:DropDownList ID="cmbTrabalhador" runat="server" Width="300px" 
                            style="margin-left:-4px;" AutoPostBack="True" onselectedindexchanged="cmbTrabalhador_SelectedIndexChanged">
                     
                        </asp:DropDownList>

                 <asp:Button ID="cmdpreenche" runat="server" Text="Preencher/Actualizar Lista" 
                        OnClick="cmdpreenche_Click" />

          </ContentTemplate>
          <triggers>
                   <asp:AsyncPostBackTrigger ControlID="cmbTrabalhador"  EventName="SelectedIndexChanged" />
        </triggers>
            </asp:UpdatePanel>

    </div>

    <asp:Panel ID="PleaseWaitMessagePanel" runat="server" CssClass="modalPopup" Height="50px"
            Width="125px">
            Please wait<br />
            <img src="img/ajax-loader.gif" alt="Please wait" /></asp:Panel>
     <asp:Button ID="HiddenButton" runat="server" CssClass="hidden" Text="Hidden Button"
            ToolTip="Necessary for Modal Popup Extender" />

        <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="PleaseWaitPopup" TargetControlID="HiddenButton" PopupControlID="PleaseWaitMessagePanel" BackgroundCssClass="modalBackground">
        </asp:ModalPopupExtender>
Posted
Comments
Rahul Rajat Singh 20-Jun-12 7:48am    
The problem is not clear but just an opinion.

Try setting AutoPostBack="false" instead of true. perhaps the trigger and autopostback=true are conflicting with each other.
Sandeep India 25-Mar-14 6:21am    
My dropdown under Updated panle so how can i track dropdownlist change event
please help

I replaced all my body content inside the ContentTemplate tags of UpdatePanel to fill all my fields correctly but when I press the "cmdPreenche" button my loading screen don't stops from loading... With only dropdownlist and button inside the ContentTemplate tags all works fine but with the problem that I refered on my last question above...
 
Share this answer
 
Not too clear by what you mean But the problem is when i click on an item of my dropdownlist don't postback (refresh whole page)..

Let me tell what your page design is doing:
1. You have two controls in your update panel - butotn and dropdownlist,
2. You have one async trigger defined

Now, based on above 2, following happens:
1. Dropdown selected change happens asynchronously and partially updates update panel
2. Button click partially updates update panel.

Async trigger defined was not needed as by default the controls in UpdatePanel postsback page asynchronously.


Now, if you wanted to have a complete page postback on dropdown values selection, then you need to use PostBackTrigger instead of AsyncPostBackTrigger.
 
Share this answer
 
Comments
Sir.Big 21-Jun-12 7:25am    
Ok That's works doing postback, thank you for your response but... Can I do the SelectedIndexChanged works with postback instead of just a whole page postback?

Because I have a lot of code to run when an item of dropdownlist is clicked, lot of fields are filled, but with a whole page postback everything is lost (values) after the code inside selectedIndexChanged event runs...

Can I just do the selectedIndexChanged event instead of a whole page postback inside the UpdatePanel?
Sandeep Mewara 22-Jun-12 1:00am    
Putting update panel just around dropdown will only update that part even after whole page postback. Values might appear changing in code behind but actually nothing changes as only update panel part is re-rendered.

Alternatively, if you want to execute just a method and avoid part of page life cycle, you can look into Callback. It will directly hit the method defined in code behind when called.
Sandeep India 25-Mar-14 6:20am    
bvfg

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