This is a migrated thread and some comments may be shown as answers.

Dropdownlist not updating

3 Answers 355 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jos
Top achievements
Rank 1
Jos asked on 31 Aug 2015, 11:06 AM

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?

 

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 03 Sep 2015, 08:52 AM
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
0
Jos
Top achievements
Rank 1
answered on 03 Sep 2015, 01:05 PM

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

0
Ivan Danchev
Telerik team
answered on 07 Sep 2015, 12:59 PM
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
Tags
DropDownList
Asked by
Jos
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Jos
Top achievements
Rank 1
Share this question
or