Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Issues with UpdatePanel using DropDownList and Button together

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

Industry Leaders: 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

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.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

636 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