This question is locked. New answers and comments are not allowed.
How can I have my combobox display nothing when my form loads? Currently when it loads it shows an item from the table it is bound too. I want the combobox to be blank/empty then the user can select what to pick. Currently there is only 1 item in the combobox. Does that have any effect? I tried to edit the combo and add a blank item but it is in the drop down but not selected.
Thank You
Thank You
7 Answers, 1 is accepted
0
Hello jerry,
Thank you for your question. You simply need to set the SelectedIndex of your combo to -1 in the Form.Shown event. Please write again if you have other questions.
Sincerely yours,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thank you for your question. You simply need to set the SelectedIndex of your combo to -1 in the Form.Shown event. Please write again if you have other questions.
Sincerely yours,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
jerry
Top achievements
Rank 1
answered on 28 Jan 2010, 01:39 PM
Victor,
Thank you for your quick response. I tried that and it still didn't work.
This is my code
But this still shows up with the value returned from my databinding and not the blank text RadComboBoxItem I added through the control.
Thank You
Thank you for your quick response. I tried that and it still didn't work.
This is my code
DataTable dt = new DataTable(); |
dt = ds.Tables[0]; |
cmbPrj.DisplayMember = "project"; |
cmbPrj.ValueMember = "id"; |
cmbPrj.DataSource = dt; |
cmbPrj.SelectedIndex = -1; |
Thank You
0
Hi jerry,
Thank you for your question. Are you executing this code in the Form.Shown event handler? I am looking forward to your reply.
Greetings,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thank you for your question. Are you executing this code in the Form.Shown event handler? I am looking forward to your reply.
Greetings,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
jerry
Top achievements
Rank 1
answered on 28 Jan 2010, 04:28 PM
Victor,
That was it. I had it in a different event. I thought I double checked that.
Thank you so much
That was it. I had it in a different event. I thought I double checked that.
Thank you so much
0
Hello jerry,
No problem, you only have to set SelectedIndex to -1 in Form.Shown, the other code can stay where it is. If you have more questions we are ready to assist you.
Greetings,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
No problem, you only have to set SelectedIndex to -1 in Form.Shown, the other code can stay where it is. If you have more questions we are ready to assist you.
Greetings,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
jerry
Top achievements
Rank 1
answered on 29 Jan 2010, 03:30 PM
Victor,
I ran into another problem with the control we are discussing in this thread.
I created the SelectedIndexChanged event for that combobox. When the user changes this combo I need to save the value into a global variable. My problem is when I load my app and bind my data to that combo the SelectedIndexChanged event fires for each row. When I set SelectedIndex to -1 in Form.Shown it fires the event again then I get a "Object reference not set to an instance of an object". I hit "OK" then my app closes. If I comment out SelectedIndex to -1 in Form.Shown I don't get the error. I'm not sure why i'm having a difficult time creating a combobox and store it's value.
Thank you for any help
Jerry
I ran into another problem with the control we are discussing in this thread.
I created the SelectedIndexChanged event for that combobox. When the user changes this combo I need to save the value into a global variable. My problem is when I load my app and bind my data to that combo the SelectedIndexChanged event fires for each row. When I set SelectedIndex to -1 in Form.Shown it fires the event again then I get a "Object reference not set to an instance of an object". I hit "OK" then my app closes. If I comment out SelectedIndex to -1 in Form.Shown I don't get the error. I'm not sure why i'm having a difficult time creating a combobox and store it's value.
Thank you for any help
Jerry
0
Hi jerry,
Please post the code that is causing you trouble. This way I will able to provide a specific answer. If possible please send a sample application which reproduces the exception. I am looking forward to your reply.
Best wishes,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Please post the code that is causing you trouble. This way I will able to provide a specific answer. If possible please send a sample application which reproduces the exception. I am looking forward to your reply.
Best wishes,
Victor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.