Solved

Issues with UpdatePanel using DropDownList and Button together

Posted on 2010-09-04
2
671 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now