Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB ASP.NET
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: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 20-Jun-12 1:55am
Sir.Big324
Comments
Rahul Rajat Singh at 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 at 25-Mar-14 6:21am
   
My dropdown under Updated panle so how can i track dropdownlist change event
please help
Rate this: bad
good
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.
  Permalink  
Comments
dafafaterte at 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 at 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 at 25-Mar-14 6:20am
   
bvfg
Rate this: bad
good
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...
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 8,963
1 OriginalGriff 6,726
2 Peter Leow 4,232
3 Zoltán Zörgő 3,769
4 Richard MacCutchan 2,558


Advertise | Privacy | Mobile
Web02 | 2.8.150123.1 | Last Updated 22 Jun 2012
Copyright © CodeProject, 1999-2015
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