Radcombobox OnTextchanged event

7 posts, 0 answers
  1. Soumya
    Soumya avatar
    108 posts
    Member since:
    Jul 2012

    Posted 26 Jul 2012 Link to this post

    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.

  2. Nencho
    Admin
    Nencho avatar
    908 posts
    Member since:
    Jun 2012

    Posted 26 Jul 2012 Link to this post

    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.

  3. Soumya
    Soumya avatar
    108 posts
    Member since:
    Jul 2012

    Posted 26 Jul 2012 Link to this post

    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



  4. Nencho
    Admin
    Nencho avatar
    908 posts
    Member since:
    Jun 2012

    Posted 31 Jul 2012 Link to this post

    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.

  5. Soumya
    Soumya avatar
    108 posts
    Member since:
    Jul 2012

    Posted 31 Jul 2012 Link to this post

    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

  6. Nencho
    Admin
    Nencho avatar
    908 posts
    Member since:
    Jun 2012

    Posted 03 Aug 2012 Link to this post

    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.

  7. Soumya
    Soumya avatar
    108 posts
    Member since:
    Jul 2012

    Posted 07 Aug 2012 Link to this post

    Thanks Nencho.
    It is working.

Back to Top