Chages not firing radCombobox ItemsRequested

2 posts, 0 answers
  1. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 04 Jun 2013 Link to this post

    Hi All,

    I have radtextbox and combobox in a single page. i am using ItemsRequested for radcombobox.
    i enter text in radtextbox and i click radcombobox ItemsRequested event.  but i am not able to get radtextbox text in ItemsRequested event.
    but i want to get radtextbox value in ItemsRequested event. is there any way. it's very important. Please any one help me ASAP.



    Thanks,
    Dhamodhran.S
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Jun 2013 Link to this post

    Hi Dhamodhran,

    During a Load On Demand request the state of all controls on the page is the initial one. That is why you are not getting the RadTextBox value.

    You can use the Context object to send the RadTextBox value to the ItemsRequested event handler as shown in this help article.

    Also please see the sample code:-

    ASPX:
    <telerik:RadTextBox ID="RadTextBox1" runat="server" >
    </telerik:RadTextBox>
     <telerik:RadComboBox ID="RadComboBox1" runat="server"  EnableLoadOnDemand="true"
        OnItemsRequested="RadComboBox1_ItemsRequested" onclientitemsrequesting="GetTextBoxValue">
    </telerik:RadComboBox>

    JavaScript:
    <script language="javascript" type="text/javascript">
        function GetTextBoxValue(sender, eventArgs) {
            var txtBox = $find("<%= RadTextBox1.ClientID %>");
            var txtBoxText = txtBox.get_value();
            var context = eventArgs.get_context();
            context["TextBoxValue"] = txtBoxText;
        }
    </script>

    CS:
    protected void RadComboBox1_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
       {
            string textBoxValue = e.Context["TextBoxValue"].ToString(); // will get RadTextBox value
       }

    -Shinu.
Back to Top