4 Replies - 8229 Views - Last Post: 07 February 2013 - 06:17 AM Rate Topic: -----

#1 Serendipitus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 21
  • Joined: 07-December 10

AJAX trigger not firing after first call

Posted 06 February 2012 - 04:02 PM

Hello,

I am developing a web app that allows a user to browse a datatable. I have an ajax updatepanel set up to only load the appropriate rows based on a value from a combobox. The code follows
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" >
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="websiteComboBox" EventName="SelectedIndexChanged" />
            </Triggers>
            <ContentTemplate>
                    <asp:TabContainer ID="TabContainer1" runat="server" 
        ActiveTabIndex="2">
                        <asp:TabPanel runat="server" HeaderText="All" ID="TabPanel1" >
                            <ContentTemplate>
                                <div class="TabContent">
                                    <asp:GridView ID="AllGridView" CssClass="GridView" runat="server" 
                                        CellPadding="4" ForeColor="#333333" GridLines="None" 
                                        ShowHeaderWhenEmpty="True" AutoGenerateColumns="True" RowStyle-Wrap="False" Font-Size="X-Small">
                                        ...
                </ContentTemplate>
            </asp:UpdatePanel>


When the page first loads and I select an option from the combobox, the gridview updates appropriately. However, when a change the combobox value the gridview does not update. The SelectedIndexChanged event does not even fire. It works fine without the ajax but there is a lot of information being loaded so narrowing down specific elements requested is essential. Any help will be much appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: AJAX trigger not firing after first call

#2 ajwsurfer  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 21
  • View blog
  • Posts: 373
  • Joined: 24-October 06

Re: AJAX trigger not firing after first call

Posted 08 February 2012 - 10:44 AM

I would first change the line:
 <asp:AsyncPostBackTrigger ControlID="websiteComboBox" EventName="SelectedIndexChanged" />

to
 <asp:AsyncPostBackTrigger ControlID="websiteComboBox" />

Then I would set the break point in the Page_Load() function and run the debugger (hit the green triangle). When the page first loads we know that works, so just hit the green button again for the first page load. Then change the Index in the "websiteComboBox" and step through the code. My guess is that the "websiteComboBox" is not triggering the update panel. That will need to be addressed first.
Was This Post Helpful? 0
  • +
  • -

#3 Serendipitus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 21
  • Joined: 07-December 10

Re: AJAX trigger not firing after first call

Posted 08 February 2012 - 04:00 PM

The problem is that the code does not even enter the event handler for the combobox after the first change. If more information is need let me know.
Was This Post Helpful? 0
  • +
  • -

#4 joetinger  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-February 13

Re: AJAX trigger not firing after first call

Posted 06 February 2013 - 01:04 PM

I have a similar situation, it works fine the first time the user selects from the combobox but any other time unless another event is fired. I have a gridview.selectedindexchange trigger also and when I select from the combobox and nothing happens and then select an item from the gridview, the gridview trigger fires AND so does the combobox trigger that I previously selected.
Was This Post Helpful? 0
  • +
  • -

#5 joetinger  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 06-February 13

Re: AJAX trigger not firing after first call

Posted 07 February 2013 - 06:17 AM

I added the combo box to the update panel and it seems to work. This isn't really what I want to do, slows it down... but here is the code

        <label for="cb1"> Customer</label> 
        <br />
        <asp:UpdatePanel ID="upCustomer" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="cbCustomer" EventName ="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="gvSiteAddress" EventName ="SelectedIndexChanged" />
            </Triggers>
            <ContentTemplate>
                <asp:ComboBox ID="cbCustomer" runat="server" AutoCompleteMode="SuggestAppend" 
                AutoPostBack="True" DataSourceID="dataSourceCBCust" DataTextField="CUST_NAME" 
                DataValueField="CUST_NAME" MaxLength="0" style="display: inline;">
                </asp:ComboBox>
                <br />
                <asp:GridView ID="gvCustomer" runat="server" AllowPaging="True" 
                AllowSorting="True" DataSourceID="dataSourceGVCust" 
                AutoGenerateColumns="True" DataKeyNames="CUST_NO">
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                    </Columns>
                </asp:GridView>
            </ContentTemplate> 
        </asp:UpdatePanel>

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1