clone a datagrid

  • Thread starter Thread starter Felix
  • Start date Start date
F

Felix

Is it possible to clone a datagrid?

I've created a datagrid on my aspx page, editing various attributes,
adding columns, etc. I would like to, in code, create an arbitrary
number of these datagrids. Any ideas?

I thought that perhaps I should createa a separate "web user control".
I added my datagrid to this control, I compiled, then I dragged the
control to my aspx page. The control did not render in the designer.

The reason I would prefer to clone, or at the very least, have the
control render nicely, is that I would like a non-programmer to be
able to go in and tweak the gui a little. This approach has worked so
far on the project.

Thanks for any help,
Felix
 
Felix,

If the DataGrid class is not Cloneable (does not contain Clone() method) you
can allways inherite from datagrid, let say, MyDataGrid that implements
ICloneable interface (and implement public object Clone() ) that will return
the cloned datagrid.
this method has to do a shallow/deep cloning - as you choose.

Picho
 
Thanks for the suggestion, but I believe that implementing the Clone()
method would not be trivial. How do I easily copy all the attributes
and columns, etc?

Thanks,
Felix
 
Back
Top