This is a migrated thread and some comments may be shown as answers.

selected Item is always blank

6 Answers 90 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Yoni
Top achievements
Rank 1
Yoni asked on 26 Apr 2011, 12:40 PM
hello,
I have a grid which has a number of columns,
one of the columns is combobox,
I am getting Data from DB from 2 Tables:

1. a table that populates the combobox - display, code.
2. a table that populates the grid - fields+display.

my problem is that I Indeed get the comboboxes full, but the selected items are always blank .

i tried to change it to label instead of combobox and then i got it right,
but I want it to be combobox.

P. S. I want the combobox to be always avalable to change, without editmode.

6 Answers, 1 is accepted

Sort by
0
Yoni
Top achievements
Rank 1
answered on 28 Apr 2011, 06:23 AM
please!!!
it is very importent for me
I'm stuck!
0
Shinu
Top achievements
Rank 2
answered on 28 Apr 2011, 07:00 AM
Hello Yoni,

I am not quite sure about your requirement and I suppose you want to get the ComboBox i normal mode. if thats is your case you can add the control in ItemTemplate , it will be available in normal mode.

Here is a sample code:
aspx:
<telerik:GridTemplateColumn HeaderText="TextBoxcol" UniqueName="ComboBoxcol">
    <ItemTemplate>
        <telerik:RadComboBox ID="RadComboBox1" runat="server"  Width="200px" DataSourceID="SqlDataSource1" EmptyMessage="Select An Item" DataTextField="FirstName">
        </telerik:RadComboBox>
      </ItemTemplate>
</telerik:GridTemplateColumn>

Thanks,
Shinu.
0
Yoni
Top achievements
Rank 1
answered on 28 Apr 2011, 09:29 AM

 

Thanks for answering..
I did what you wrote, but I still get the comboboxes selected Items - blank.
(the combo boxes are populated)
How can i make them display the right value (According to Data Base)?
waiting for an answer,
yoni
0
Yoni
Top achievements
Rank 1
answered on 28 Apr 2011, 09:29 AM
 
0
Dimitar Terziev
Telerik team
answered on 29 Apr 2011, 07:31 AM
Hi Yoni,

In order to determine what is causing this problem in your scenario we would need some more information. Please share with us your declaration of the RadGrid along with the RadComboBox and the way you bind them to a data source.

Regards,
Dimitar Terziev
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Yoni
Top achievements
Rank 1
answered on 01 May 2011, 08:59 AM

Thanks for the help
it works!!
my problem was, i did this code in the Combo_Init instead of putting it in the RadGrid1_ItemDataBound

 

now i put it there (RadGrid1_ItemDataBound) and it works.

 

TryCast(e.Item.FindControl("RadComboBox1"), RadComboBox).DataTextField = "ModelDesc"
  
TryCast(e.Item.FindControl("RadComboBox1"), RadComboBox).DataValueField = "ModelId"
  
TryCast(e.Item.FindControl("RadComboBox1"), RadComboBox).DataBind()
  
TryCast(e.Item.FindControl("RadComboBox1"), RadComboBox).SelectedValue = SelectedValueString

 

 

 

Tags
ComboBox
Asked by
Yoni
Top achievements
Rank 1
Answers by
Yoni
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Dimitar Terziev
Telerik team
Share this question
or