public gridview datagrid2gridview(datagrid dg)
{
gridview gv = new gridview();
foreach(var p in dg.columns)
{
if(p is boundcolumn)
{
boundcolumn dgc = (boundcolumn)p;
var gvc=new boundfield();
gvc.headertext=dgc.headertext;
gvc.visible=dgc.visible;
gvc.datafield=dgc.datafield;
gvc.headerstyle.width=dgc.headerstyle.width;
gv.columns.add(gvc);
}
}
}