Solved

Issues with UpdatePanel using DropDownList and Button together

Posted on 2010-09-04
2
678 Views
Last Modified: 2012-05-10
I have a UpdatePanel that contains 2 DropDownList controls, a Button and a Gridview control. When you select the first dropdown which contains state it calls the eventhandler to populate the second dropdown with the cities from that state.

The problem comes in that when you press the button, it does not call its eventhandler. But if I press the button prior to selecting a state, it will fire the eventhandler. Can someone please help with this issue. My markup is below.

<asp:UpdatePanel ID="updSearch" UpdateMode="Conditional" runat="server">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
    </Triggers>
    <ContentTemplate>
        <asp:DropDownList ID="lstState" AutoPostBack="true" OnSelectedIndexChanged="lstState_SelectedIndexChanged" runat="server" /><br />
        <asp:DropDownList ID="lstCity" runat="server" />
       
        <div  class="divPlaceHolderRow"><br /></div>        
        <div class="divPlaceHolderRow"><asp:Button ID="btnSearch" OnClick="btnSearch_Click" runat="server" Text="Search" /><br /></div>
        <div class="divPlaceHolderRow"><br /></div>
        <div id="DivSearchGrid">
            <asp:GridView ID="grdPharmacy"
                            CssClass="GridViewSearch"  
                            runat="server"
                            Visible="true"
                            OnRowCommand="grdPharmacy_RowCommand"
                            HorizontalAlign="Center"
                            PagerSettings-Visible="true"              
                            AllowPaging ="true"  
                            AllowSorting="true"
                            Caption="Search Results"
                            CaptionAlign="Left"
                            ShowHeader="true"
                            ShowFooter="true" >                 
            <SelectedRowStyle BackColor="Beige" />
            <HeaderStyle CssClass="GridHeader" />
            <RowStyle CssClass="GridRow" />
            <FooterStyle ForeColor="Green" />
            <SelectedRowStyle CssClass="GridSelected" />  
            <PagerStyle CssClass="GridPager" />
            <PagerSettings Mode="NextPrevious"
                            NextPageText="Next >" 
                            PreviousPageText="< Prev" />                        
            </asp:GridView>
        </div>

    </ContentTemplate>      
</asp:UpdatePanel>
0
Comment
Question by:rawcoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 33608764
My first guess would be that the button is the only async post-back trigger, so when the DropDownList is selected, the AutoPostBack=true forces a post-back, which is not a trigger for the UpdatePanel...
0
 

Author Closing Comment

by:rawcoder
ID: 33721570
This was part of the issue. It also had to do with the update panels I was using.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question