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

Saving gridview with combobox columns giving null values

1 Answer 228 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sree
Top achievements
Rank 1
Sree asked on 12 Sep 2013, 08:58 AM
Hello Telerik Team,
 i have some issues with the comobobox column of radgridview for winforms

here is the below code

                GridViewComboBoxColumn colLithography = new GridViewComboBoxColumn();
                colLithography.DataType = typeof(string);
                colLithography.DataSource = dt; // dt is having only one Column called Name
                colLithography.HeaderText = "Lithography";
                colLithography.ValueMember = "Name";
                colLithography.DisplayMember = "Name";
                colLithography.FieldName = "Name";
                //colLithography.DataType=
                this.rGVPP.Columns.Insert(2, colLithography); // rGVPP is Radgridview

Above code perfectly added the values to the combobox

but now i want to save the gridview data to database,


So in Btn_Save click i am reading sending the gridview values to a query like below, observe the debug at break point which is the code
and in the quick watch window the value is null, throwing exception here

but my grid having values in all the cell, when i try to read the value of a particular cell of combobox column, its giving null value.

Please help me.

1 Answer, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 17 Sep 2013, 11:08 AM
Hi Sree,

You can get a cell from the Cells of a row passing the Name property value of its column rather than the name of the column instance. I can see that there is no Name set for your column, so you need to set one. Considering the column definition from the beginning of this article we would take the cell by Cells["SupplierColumn"]. 

I hope this helps. Let me know if you have additional questions.

Regards,
Nikolay
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Sree
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or