This is a migrated thread and some comments may be shown as answers.
RadListBox doesn't highlight the selected line
2 Answers 19 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
deng bruce
Top achievements
Rank 1
deng bruce asked on 10 May 2011, 07:40 AM
as:
{
   listBox.DataSource = m_dtRequisition;
   listBox.DisplayMember = "FileName";
   listBox.ValueMember = "RequisitionGuid";
}




when i should select the last index for radlistbox,  but why the listbox doesn't highlight the selected line? 
{
   DataTable dt = listBox.DataSource as DataTable;
   listBox.selectedindex = dt.Rows.Count;
}

2 Answers, 1 is accepted

Sort by
0
deng bruce
Top achievements
Rank 1
answered on 10 May 2011, 07:48 AM
It is ok as

 DataTable dt = listBox.DataSource as DataTable;
                if (dt.Rows.Count > 0)
                {
                    listBox.SelectedIndex = dt.Rows.Count - 1;
                }
0
Peter
Telerik team
answered on 12 May 2011, 07:43 AM
Hello deng,

Thank you for the writing.

Indeed, in order to select the last item, you should set the SelectedIndex to the Count minus one. I am glad that you have found the answer to the question.

I would like to let you know that RadListBox control is obsolete since Q2 2010. Once we release Q2 2011, this control will no longer be supported. This is why, it is highly recommendable to upgrade to its ancestor - RadListControl.

Best wishes,
Peter
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Asked by
deng bruce
Top achievements
Rank 1
Answers by
deng bruce
Top achievements
Rank 1
Peter
Telerik team
Share this question
or