RadListBox runtime creating...

7 posts, 0 answers
  1. David
    David avatar
    14 posts
    Member since:
    Jul 2008

    Posted 09 Jul 2008 Link to this post

    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);

  2. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 10 Jul 2008 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. David
    David avatar
    14 posts
    Member since:
    Jul 2008

    Posted 10 Jul 2008 Link to this post

    Thanks a lot!!! it worked great!!! =D
  5. Raj
    Raj avatar
    10 posts
    Member since:
    Mar 2012

    Posted 27 Mar 2012 Link to this post

    I am creating RadListBox in RadGrid programatically and i need to set the

    SelectionMode="Multiple".

    Thanks,
    Raj

  6. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 28 Mar 2012 Link to this post

    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 >>
  7. Raj
    Raj avatar
    10 posts
    Member since:
    Mar 2012

    Posted 22 Apr 2012 Link to this post

    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
  8. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 25 Apr 2012 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready