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
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
SelectionMode="Multiple".
Thanks,
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
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
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.
Nikolay
the Telerik team