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

Radcombobox OnTextchanged event

6 Answers 240 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Soumya
Top achievements
Rank 1
Soumya asked on 26 Jul 2012, 08:31 AM
I have a radcombobox and values are populated in the OnItemsRequested event.
In this event ,Iam setting item.text as 'text to be displayed' and item.value as the Id of the field,which I can get using Radcombobox1.SelectedValue.Split(new char[] { ':' })[1].

1)if the user types a value in the combo box,then how can I get the Id of that field in the Textchanged event?
2)If the user types  something and no match is found,how can I make the loading table invisible?

Thanks,
Soumya.

6 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 26 Jul 2012, 01:15 PM
Hi Soumya,

Could you elaborate a bit more on what exactly is the required functionality described on your first point. And about the second one, what exactly do you mean by "loading table" (the data which RadComboBox is being populated with)?

Regards,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 26 Jul 2012, 01:39 PM
Hi Nencho,
1)I have a radcombobox with 2 columns as shown in http://demos.telerik.com/aspnet-ajax/combobox/examples/default/defaultcs.aspx 
Combobox is loaded in OnItemsRequested  event.
in the ItemsRequeasted event,text and values are moved as below.

item.Text = (string) dataRow["ProductName"];
item.Value = dataRow["ProductID"].ToString(); 
item.Attributes.Add("UnitPrice", unitPrice.ToString());
                item.Attributes.Add("UnitsInStock", unitsInStock.ToString());

                item.Value += ":" + unitPrice; 

In the program I can access both Productname and unitprice,if I select the values from dropdown box(Both in Indexchanged event and Ontextchanged event).
But if I types in the combobox(Ontextchanged event),and press enter,I am not able to get the value of second column.
I need to move the second column value to a textbox in either case.
But on textchanged event,I am not able to get the 2nd column,if the user does not select from the dropdown list.
2)On typing a value in the above  combobox,a table is loaded with all the data in the dropdown.But if user enters a value that doesn't match the records in the dropdown,I dont want to show the empty dropdown.

Hope you understood.
Please let me know if you need any more clarifications.
Thanks,
Soumya



0
Nencho
Telerik team
answered on 31 Jul 2012, 10:24 AM
Hello Soumya,

Indeed the SelectedValue should not be empty, so we started investigating the issue - it looks like a bug and I forwarded it to our development team. Thank you for taking your time to report this, your Telerik points are updated. As for the second question, you described the functionality provided by the Filter. If you remove the FIlter property of the RadComboBox the data will be present at any time.

All the best,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 31 Jul 2012, 10:41 AM
Hi Nencho,
Thanks for the reply.
In my second question,I need to show the product name starting with a particular letter when the user type in the combobox.Hence I use "Filter="StartsWith"  " and  ItemsRequested event.
Is there any way to remove the dropdown which is empty, once no match is found for the typed product name?

Thanks,
Soumya
0
Nencho
Telerik team
answered on 03 Aug 2012, 08:17 AM
Hello ,

In order to achieve the desired functionality, please consider using the following approach :

<script type="text/javascript">
 
       function OnClientItemsRequested(sender, args) {
 
           if (sender.get_items().get_count() == 0)
               sender.hideDropDown();
       }
   </script>



Greetings,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Soumya
Top achievements
Rank 1
answered on 07 Aug 2012, 05:32 AM
Thanks Nencho.
It is working.
Tags
ComboBox
Asked by
Soumya
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Soumya
Top achievements
Rank 1
Share this question
or