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

how to get radcombox item values in client side

5 Answers 656 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 05 Apr 2011, 11:45 AM
Hi,

I want particular index item values in radcombobox in client side. in code behind we have get easily like ddlCountyName.Items(1).Text but how to get the same in client side.

Please give me a tips for this one.


Thanks,
Dhamu.

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Apr 2011, 12:44 PM
Hello Dhamu,

You can access the RadComboBoxItem with index value like below.
javascript:
function accessItem()
    {
        var combo = $find("<%= RadComboBox1.ClientID %>");
        var item = combo.get_items().getItem(2);//accessing the item using the index
        alert(item.get_text());   
   }

Thanks,
Shinu.
0
Dhamodharan
Top achievements
Rank 1
answered on 05 Apr 2011, 12:50 PM
Hi Shinu,

Thanks for your quick reply.

I have two radcombobox. i want set same selected index for two radcombox.

first i have get selected index from first combobox in client side. like combo.get_selectedIndex() in the same time i want set selected index into second combobox in first combox onclientselectedindexchanged event.

Please let me know.

Thanks,
Dhamu.

0
Princy
Top achievements
Rank 2
answered on 05 Apr 2011, 01:17 PM
Hi Dhamu,

I hope follwoing documentation links will be of help in this.
Client-Side Basics
RadComboBox Object
RadComboBoxItem Object


Regards,
Princy.
0
Dhamodharan
Top achievements
Rank 1
answered on 05 Apr 2011, 01:27 PM
Hi Princy,

I am sure how to set selectedIndex for radcombobox.

I am using combo2.set_selectedIndex(combo1.get_selectedIndex()). but it is not working.

Please let me know if you have any other tips.

Thanks,
Dhamu.

0
Shinu
Top achievements
Rank 2
answered on 06 Apr 2011, 07:51 AM
Hello Dhamu,

Try the following code to achieve the same.
Javascript:
function onClientSelectedIndexChanged(sender,args)
{
      var combo = sender
      var combo2 = $find("<%= RadComboBox2.ClientID %>");
      combo2.clearSelection();
      combo2.set_selectedIndex(combo.get_selectedIndex());
}

Thanks,
Shinu.
Tags
ComboBox
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Dhamodharan
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or