Clone GridViewDataColumn

2 posts, 0 answers
  1. Rob Hedgpeth
    Rob Hedgpeth avatar
    7 posts
    Member since:
    May 2011

    Posted 28 Jun 2011 Link to this post

    Is it possible to clone a GridViewDataColumn?
  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 01 Jul 2011 Link to this post

    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!
Back to Top