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

RadListBox runtime creating...

6 Answers 118 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 09 Jul 2008, 05:59 PM

Hi... im creating a RadListBox at runtime with a win app and it creates with the correct items but... I cant select any of them!!! =S... thats really weird and I've been trying many options... can you help me with that issue?

here's my code.

RadListBox

lista = new RadListBox();

for

(int j = 0; j < listaCuartoSel.Count; j++)

{

RadListBoxItem item = new RadListBoxItem();

item.Text = listaCuartoSel[j].Nombre;

string pathImagen = "ImagePath";

Image imagenCuarto = Image.FromFile(pathImagen);

item.Image = imagenCuarto;

item.Alignment =

ContentAlignment.TopLeft;

item.ImageAlignment =

ContentAlignment.MiddleRight;

item.TextImageRelation =

TextImageRelation.ImageBeforeText;

lista.Items.Add(item);

}

lista.Enabled =

true;

lista.Virtualized =

true;

lista.IsAccessible =

true;

lista.SelectedIndex = 0;

lista.Width = 300;

this

.Controls.Add(lista);

6 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 10 Jul 2008, 02:08 PM
Hello David,

You are selecting items, actually. However, since you are creating RadListBox at runtime only with your code, you do not have styling applied and therefore you are not able to observe the selection.

When creating RadListBox programmatically, you should call the EndInIt() method which will make the control styled:
RadListBox lista = new RadListBox();  
 
for(int j = 0; j < 10; j++)  
{  
    RadListBoxItem item = new RadListBoxItem();  
    item.Text = j.ToString();  
    item.Alignment = ContentAlignment.TopLeft;  
    item.ImageAlignment = ContentAlignment.MiddleRight;  
    item.TextImageRelation = TextImageRelation.ImageBeforeText;  
    lista.Items.Add(item);  
}  
 
lista.Enabled = true;  
lista.Virtualized = true;  
lista.IsAccessible = true;  
lista.SelectedIndex = 0;  
lista.Width = 300;  
this.Controls.Add(lista);  
lista.EndInit(); 

If you have additional questions, feel free to contact me.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 10 Jul 2008, 02:32 PM
Thanks a lot!!! it worked great!!! =D
0
Raj
Top achievements
Rank 1
answered on 27 Mar 2012, 04:36 PM
I am creating RadListBox in RadGrid programatically and i need to set the

SelectionMode="Multiple".

Thanks,
Raj

0
Nikolay
Telerik team
answered on 28 Mar 2012, 09:32 AM
Hi Raj,

Please note that RadListBox has been obsolete for more than 1,5 years and it was removed from our suite in Q3 2011. We do not support this control anymore. In case you require a listbox behavior, you should use RadListControl instead. You can use this article as a guide to update to the new control. Let us know if you have questions regarding RadListControl.

Regards,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Raj
Top achievements
Rank 1
answered on 23 Apr 2012, 04:19 AM
Hi,
I have one issue radgrid sorting is not reflected in Dataset.

I am sorting the radgrid after sorting the data in dataset is not sorting,

I have a scenario for this iam adding new rows to grid,new rows are updating to dataset.(there is no Datakey for thease records) for this we are not updating to DataBase.
After sorting,issue comes with deleting,i need to delete record from radgrid ,iam using e.item.datasetindex for deleting which is pointing to diff record in dataset.
what is the bestway to delete records from radgrid that weill effect in dataset after radgrid sorting.

Please help me with this issue.

Thanks,
Raj
0
Nikolay
Telerik team
answered on 25 Apr 2012, 10:32 AM
Hi Raj,

Please note that this thread concerns RadControls for WinForms rather than RadControls for ASP.NET Ajax. I would suggest that you open a new thread in the appropriate forum section. I also noticed that you have posted the same question in another WinForms forum thread. Please avoid asking the same question in different threads as this may slow down our response.

Thank you for your understanding.

Regards,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
David
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
David
Top achievements
Rank 1
Raj
Top achievements
Rank 1
Share this question
or