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

How do you select value from RadListBox?

3 Answers 110 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Maurice
Top achievements
Rank 1
Maurice asked on 23 Oct 2012, 03:07 PM
I've tried several things and I've found several different code samples and none of them work. I get a red line under some of the text.
This is for Silverlight 5 by the way.

I tried this code but it doesn't work: radListBox1.Items[1].Text  (I get a red line under Text)

And i get a red line under text in the following as well:
radListBox1.SelectedIndex.Text
radListBox1.SelectedItem.Text

I don't know what else to do

I found this example and it doesn't work either
label1.Content = radListBox1.Items[1].Value;

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 26 Oct 2012, 03:21 PM
Hi Keoki,

What type of RadListBox are you testing? Is it a Silverlight RadListBox or an Html RadListBox?

I was able to successfully get the text of a Silverlight list box item using the following code against this Silverlight RadListBox demo.
Telerik.WebAii.Controls.Xaml.RadListBox xamlListBox = ActiveBrowser.SilverlightApps()[0].Find.ByAutomationId<Telerik.WebAii.Controls.Xaml.RadListBox>("RadListBox");
 
Log.WriteLine(xamlListBox.Items[1].Text);

And the following code against this HTML RadComboBox demo.
Telerik.WebAii.Controls.Html.RadListBox listBox = ActiveBrowser.Find.ById<Telerik.WebAii.Controls.Html.RadListBox>("ctl00_ContentPlaceHolder1_RadListBoxSource");
 
Log.WriteLine(listBox.Items[1].Text);


Regards,
Plamen
the Telerik team
Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
Vote now
0
Maurice
Top achievements
Rank 1
answered on 29 Oct 2012, 04:21 PM
thanks for the reply. I am using Silverlight. Sorry for not specifying.

I got it to work. thanks!
0
Plamen
Telerik team
answered on 30 Oct 2012, 08:32 AM
Hi Maurice,

I'm glad to hear you got it working! Thanks for the update.

Regards,
Plamen
the Telerik team
Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
Vote now
Tags
General Discussions
Asked by
Maurice
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Maurice
Top achievements
Rank 1
Share this question
or