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

GridViewMultiComboBoxColumn

4 Answers 250 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Victoria F
Top achievements
Rank 1
Victoria F asked on 22 Nov 2010, 05:06 PM
Hello  ,

Lets see If column "CategoryName" is the first column ,
So , first I'm writing :
radGridView1.DataSource  = dtDataTable;

after this line goes code:
radGridView1.Columns.Remove("CategoryName");
GridViewMultiComboBoxColumn column = new GridViewMultiComboBoxColumn();
column.FieldName = "CategoryName";
radGridView1.Columns.Add(column);
the new column appears at the end , so I have to move it at the right place:

 

radGridView1.Columns.Move(radGridView1.Columns.Count - 1, 0);
But what happened with retrieved values of this column?
The column is empty.
So do I have to loop through and copy all the values from the removed column and assign them to the new one or there is a solution that all originally retrieved values are reflected in a new MultiComboBoxColumn?

In a case when I'm trying to assign the values .. it does not work because the cells after this assignment still empty...???? :
if (dtSource.Rows.Count > 0)
   {
     for (int i = 0; i < radGridView1.Rows.Count; i++)
     {
       radGridView1.Rows[i].Cells["c_price_lob"].BeginEdit();
       radGridView1.Rows[i].Cells["c_price_lob"].Value = dtSource.Rows[i][3].ToString();
       radGridView1.Rows[i].Cells["c_price_lob"].EndEdit();
      }
   }


Thank you ,
Victoria.

4 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 22 Nov 2010, 06:15 PM
hello Victoria F,

I see that you have just received a reply to this question here
Richard
0
Victoria F
Top achievements
Rank 1
answered on 22 Nov 2010, 09:46 PM

Actually , I'm waiting for the answer on the important question (second part of my previous post) : WHY the column which is bind to the datasource is empty?

The column in the gridview is empty. All other columns are populated from the datasource exept this one... 
Please , see the picture attached...
The values are in the GridViewMultiComboBoxColumn. So when I open dropdown box the values are there.
 In debugger I see that the column #3 HAS values, but why those values are not displayed in the gridview?

radGridView1
.Rows[i].Cells[3].Value  = "PO_1", but on the screen it's empty...?????

 
Please , I need an answer in C#.

Thank you,
Victoria.

0
Richard Slade
Top achievements
Rank 2
answered on 22 Nov 2010, 10:52 PM
Hello Victoria,

Please see my reply in your other thread. I suggest just replying and opening one thread as this slows down response times for Telerik as they have to review more than one thread
Hope the other reply has helped
Richard
0
Jack
Telerik team
answered on 23 Nov 2010, 05:53 PM
Hello Victoria,

The column is empty because the FieldName for the multi-column combo box column is not matching to a column from your data source. RadGridView uses this property to map all columns. Please check the solution from Richard. If you still have questions, we will be glad to assist.
 
Regards,
Jack
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
Tags
GridView
Asked by
Victoria F
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Victoria F
Top achievements
Rank 1
Jack
Telerik team
Share this question
or