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

2 posts, 0 answers
  1. Brandon Spilove
    Brandon Spilove avatar
    8 posts
    Member since:
    Jul 2005

    Posted 30 Dec 2010 Link to this post

    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"
                                     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;

    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.

  2. Simon
    Simon avatar
    2281 posts

    Posted 03 Jan 2011 Link to this post

    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,
    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.
Back to Top