This question is locked. New answers and comments are not allowed.
When I use the RadComboBox through the designer all works correctly. I now want to add the RadComboBox dynamically through code. When I bind this control to a datasource, it will not work for me. Please help.
RadComboBox box = new RadComboBox();
box.DisplayMember =
"name";
box.ValueMember =
"portfolioId";
box.DataSource = p.DefaultView;
box.Top = 10;
box.Left = 10;
Controls.Add(box);
6 Answers, 1 is accepted
0
carisch
Top achievements
Rank 1
answered on 13 Mar 2008, 02:36 PM
Submitted too soon, let me clarify.
- the control is on my form, but it is not styled like a designer created one. It looks very bad.
- it is not bound to anything, no drop down effects at all.
0
Hello carisch,
If you want to dynamically create a RadComboBox and bind it, you should first add it to the form's controls collections and after that set its DataSource. As far as its style it concerned, a theme should be applied to the control.
Please refer to the code snippet below:
If you have additional questions, do not hesitate to contact me.
Greetings,
Nikolay
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
If you want to dynamically create a RadComboBox and bind it, you should first add it to the form's controls collections and after that set its DataSource. As far as its style it concerned, a theme should be applied to the control.
Please refer to the code snippet below:
RadComboBox box = new RadComboBox(); |
box.DisplayMember = "name"; |
box.ValueMember = "portfolioId"; |
box.ThemeName = "ControlDefault"; |
box.Top = 10; |
box.Left = 10; |
this.Controls.Add(box); |
box.DataSource = p.DefaultView; |
If you have additional questions, do not hesitate to contact me.
Greetings,
Nikolay
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Carisch
Top achievements
Rank 1
answered on 15 Mar 2008, 12:13 PM
Thanks that was it.
Is this documented anywhere that I could have solved this issue on my own? Can you point me to that documentation.
To be honest, no controls I've worked with have ever needed to be added to the collection first, before binding. I wasted a good several hours on this issue.
Thanks again,
Brian.
Is this documented anywhere that I could have solved this issue on my own? Can you point me to that documentation.
To be honest, no controls I've worked with have ever needed to be added to the collection first, before binding. I wasted a good several hours on this issue.
Thanks again,
Brian.
0
Hi Brian,
Thank you for pointing the comparison out.
We will consider changing the behavior of RadComboBox for the Q1 2008 release, so you will be able to first bind it and then add it to the controls collection.
If you have additional questions, do not hesitate to contact me.
Greetings,
Nikolay
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for pointing the comparison out.
We will consider changing the behavior of RadComboBox for the Q1 2008 release, so you will be able to first bind it and then add it to the controls collection.
If you have additional questions, do not hesitate to contact me.
Greetings,
Nikolay
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
fruzicka
Top achievements
Rank 1
answered on 05 Jun 2008, 11:29 AM
Sorry, this belongs to radGridView. Can please someone delete it from here.
Hi, im have troubles with this too. Using the latest release Q1 SP1 2008 my GridViewComboBoxColum (GridViewLookupColumn) doesn't show any values. here some snipet (this was working in Q3 2007):
GridViewLookUpColumn tcReason = new GridViewLookUpColumn(); |
tcReason.UniqueName = "Reason"; |
tcReason.FieldName = "IdReason"; |
tcReason.HeaderText = "Reason"; |
tcReason.DataSource = colReason |
tcReason.DisplayMember = "Name"; //colReason |
tcReason.ValueMember = "Id"; //colReason |
//... |
rgvStamps.Columns.Insert(rgvStamps.Columns.Count, tcReason); |
//... |
rgvStamps.Datasource = colStamps; |
0
Hello fruzicka,
I was not able to reproduce the issue. Please open a support ticket and send me a sample application which demonstrates it. This will allow me to address any potential issue further.
I am looking forward to your response.
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I was not able to reproduce the issue. Please open a support ticket and send me a sample application which demonstrates it. This will allow me to address any potential issue further.
I am looking forward to your response.
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center