Dropdownlist not updating

4 posts, 0 answers
  1. Jos
    Jos avatar
    2 posts
    Member since:
    Dec 2011

    Posted 31 Aug 2015 Link to this post

    I have the following problem with a Telerik RadDropDownList:
    Markup:

     

    <asp:UpdatePanel ID="updatepanelInput" runat="server" UpdateMode="Conditional">
       <ContentTemplate>
          <asp:TextBox ID="txtInput" runat="server" ClientIDMode="Static" />
          <asp:Button ID="btnSearch" OnClick="btnDoSearch_Click" runat="server" ClientIDMode="Static" />
          <telerik:RadDropDownList ID="ddlResults" runat="server" ClientIDMode="Static" DropDownWidth="70%" AutoPostBack="true" OnSelectedIndexChanged="ddlResults_SelectedIndexChanged"/>
          <telerik:RadDropDownList ID="ddlHistoryDates" runat="server" ClientIDMode="Static" AutoPostBack="true" OnSelectedIndexChanged="ddlHistoryDates_SelectedIndexChanged" />
       </ContentTemplate>
       <Triggers>
          <asp:AsyncPostBackTrigger ControlID="ddlResults" EventName="DataBound" />
       </Triggers>
    </asp:UpdatePanel>

    Code behind:
    protected void btnDoSearch_Click(object sender, EventArgs e)
    {
         AsynchronousQueryExecutor.Call(dataservice.getQuickSearch(currentLan, txtInput.Text, (int)SearchOptions.IncludeInactive), QuickSearchLoaded, LoadFailed); //on query success 'QuickSearchLoaded' will be executed
    }
     
    public void QuickSearchLoaded(List<spData4_QuickSearch_NomenBaseResult> result)
    {
        ddlResults.DataSource = result;
        ddlResults.DataValueField = "id";
        ddlResults.DataTextField = "description";
        ddlResults.DataBind();
     
        AsynchronousQueryExecutor.Call(dataservice.getHistoryDates(result.FirstOrDefault().id), HistoryDatesLoaded, LoadFailed); //on query success 'HistoryDatesLoaded' is executed
    }
    public void HistoryDatesLoaded(List<spData4_Historiek_GetHistoriek_BedragenResult> result)
    {
        ddlHistoryDates.DataSource = result;
        ddlHistoryDates.DataValueField = "DateHistory";
        ddlHistoryDates.DataTextField = "Item";
        ddlHistoryDates.DataBind();
    }

    So basically when btnSearch is clicked a query result should fill ddlResults and based on this result a new query is executed and returning a result which should be filled in ddlHistoryDates. Both query are executed successfully, but only ddlResults is showing data. ddlHistoryDates stays empty.
    Calling updatePanelInput.Update() after ddlHistoryDates.DataBind() is giving me the following error:
    the update method can only be called on updatepanel with id before render
    Anyone who knows what i'm doing wrong?

     

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    833 posts

    Posted 03 Sep 2015 Link to this post

    Hello,

    You can try setting the UpdatePanel's ChildrenAsTriggers property to "true" and check whether this fixes the issue and deals with the exception. This would update the UpdatePanel automatically and you won't have to call Update() explicitly.

    Are both DropDownList controls bound if you wrap the controls in a RadAjaxPanel instead of in an asp:UpdatePanel?

    Regards,
    Ivan Danchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jos
    Jos avatar
    2 posts
    Member since:
    Dec 2011

    Posted 03 Sep 2015 in reply to Ivan Danchev Link to this post

    Hi Ivan,

     

    Thanks for your reply.

    Setting the ChildrenAsTriggers property to true does not solve the issue.

    Wrapping a RadAjaxPanel around the dropdownlists or replacing the as:updatePanel with a RadAjaxPanel did not solve the issue either.

    However ddlHistoryDates.DataSource is set with 18 results, these results are not visible...

     

    Kind Regards,

    Dieter

  5. Ivan Danchev
    Admin
    Ivan Danchev avatar
    833 posts

    Posted 07 Sep 2015 Link to this post

    Hello Dieter,

    My advise is to open a support ticket, isolate the DropDownList and attach a sample runnable project that demonstrates the issue. This would allow us to test it and try to find out why the control is not binding correctly in this particular scenario.  Our guidelines could be helpful with isolating the issue.

    Regards,
    Ivan Danchev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top