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

Chages not firing radCombobox ItemsRequested

1 Answer 215 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 04 Jun 2013, 06:19 PM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jun 2013, 08:33 AM
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.
Tags
ComboBox
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or