?
Solved

Issues with UpdatePanel using DropDownList and Button together

Posted on 2010-09-04
2
Medium Priority
?
680 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 1500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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!
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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