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

ItemsRequested interaction with other web controls doesn't get current state

1 Answer 56 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Brandon Spilove
Top achievements
Rank 1
Brandon Spilove asked on 30 Dec 2010, 09:38 PM
I have a RadComboBox I am using ItemsRequested to populate the combobox with data that is filtered by the contents of another asp:TextBox control. So it is something like this:

<asp:TextBox runat="server" id="txtFilter" />
 
<telerik:RadComboBox runat="server" ID="rcbPCN" AllowCustomText="true" EnableLoadOnDemand="true"
                                 OnItemsRequested="rcbPCN_ItemsRequested"
                                 AutoPostBack="True" CausesValidation="False"
                                onselectedindexchanged="rcbPCN_SelectedIndexChanged" Filter="StartsWith" />
 
.... code behind:
 
        protected void rcbPCN_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
        {
                var query = PlanManager.QueryPlans().Where(q => q.bin == txtFilter.Text);
                rcbPCN.DataSource = query;
                rcbPCN.DataBind();
        }

The problem is that txtFilter.Text in the ItemsRequested event is only read the first time. After I delete the text from the RadComboBox, then change the text in txtFilter, then click the arrow on the combobox again, the results it shows me are from the original value of txtFilter.Text, not the newly changed value. How can I get around this? I need the combobox to always show a list of results that match the current value of txtFilter.Text.

thanks!
Brandon

1 Answer, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 03 Jan 2011, 10:05 PM
Hello Brandon Spilove,

During a Load On Demand request the state of all controls on the page is the initial one. That is why the TextBox' value does not reflect that on the client.

In this case you could use the Context object to send the TextBox value to the ItemsRequested event handler as shown in this help article.

I hope this helps.

All the best,
Simon
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ComboBox
Asked by
Brandon Spilove
Top achievements
Rank 1
Answers by
Simon
Telerik team
Share this question
or