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

Clone GridViewDataColumn

1 Answer 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rob Hedgpeth
Top achievements
Rank 2
Rob Hedgpeth asked on 28 Jun 2011, 09:04 PM
Is it possible to clone a GridViewDataColumn?

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 01 Jul 2011, 09:55 AM
Hi Rob,

You can not instantiate the GridViewDataColumn directly in your code. You can make your implementation of a column and inherit the base GridViewDataColumn. If you mean to clone data of a column, you can create a new column and setup the FieldName to be the same like some existing column in bound mode. This will automatically show the same data.

If RadGridView is used in unbound mode when you create a new column, you must iterate over all rows and manually set values for the new column using data from the existing one.

foreach(GridViewDataRowInfo row in radgridView1.ChildRows)
 {
    row.Cells["B"].Value = row.Cells["A"].Value;
 }

I hope this helps.

All the best,

Julian Benkov
the Telerik team
Registration for Q2 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting July 18th and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Rob Hedgpeth
Top achievements
Rank 2
Answers by
Julian Benkov
Telerik team
Share this question
or