Click here to Skip to main content
12,952,725 members (45,750 online)
Rate this:
Please Sign up or sign in to vote.
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:ScriptManager ID="ScriptManager1" runat="server">

<asp:UpdatePanel ID="PleaseWaitPanel" runat="server" RenderMode="Inline">
                        <asp:DropDownList ID="cmbTrabalhador" runat="server" Width="300px" 
                            style="margin-left:-4px;" AutoPostBack="True" onselectedindexchanged="cmbTrabalhador_SelectedIndexChanged">
                 <asp:Button ID="cmdpreenche" runat="server" Text="Preencher/Actualizar Lista" 
                        OnClick="cmdpreenche_Click" />
                   <asp:AsyncPostBackTrigger ControlID="cmbTrabalhador"  EventName="SelectedIndexChanged" />
    <asp:Panel ID="PleaseWaitMessagePanel" runat="server" CssClass="modalPopup" Height="50px"
            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">
Posted 20-Jun-12 0:55am
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
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
dafafaterte 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
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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...

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,289
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,900

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 22 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100