i have two Ultragridview(Ultragridview1,Ultragridview2)
ultragridview1 data load database
after i insert 3 column (3 column no in database) and i import values for column new insert in ultragridview1
i want copy all data of Ultragridview1 to Ultragridview2 include 3 column new insert(value)
this is code of i:Ultragridview1.DataSource=Ultragridview2.DataSource but it no view 3 column new insert and value import in 3 column.
you help me?thank
If you want to copy over all the data from *unbound* columns to another grid, you would first have to add those unbound columns to the other grid, then loop through all the rows in the grid and copy them over. Since they're bound to the same data source, you can just do a straight loop:
for(int i=0; i < grid1.Rows.Count; i++)
{
UltraGridRow row = grid1.Rows[i];
UltraGridRow row2 = grid2.Rows[i];
row2.Cells["Unbound Column 1"].Value = row1.Cells["Unbound Column 2"].Value
// Same thing for other unbound columns
}
-Matt
i want copy all data grid1 (column and value new insert,column and value no in database) to grid2
row2.Cells["column_name1"].Value = row1.Cells["column_name1"].Value ?
i have image but i not Post
Yes, that it what you would have to do. Within the 'for' loop you could also loop through all the columns:
foreach(UltraGridColumn column in row.Band.Columns)
row2.Cells[column].Value = row1.Cells[column].Value
hi !
grid_step5.DataSource = grid_step4.DataSource
grid_step4 bata load database after i insert 4 column new in grid_step4(4 column no in database)
i want coppy 4 column(header) to grid_step5
For i2 As Integer = 0 To grid_step4.DisplayLayout.Bands(0).Columns.Count
If grid_step4.DisplayLayout.Bands(0).Columns(i2).Header.Caption.Count Then
grid_step5.DisplayLayout.Bands(0).Columns(i2).Header.Caption.Count()
End If
thank Matt
I can't really tell what you're trying to do with your code, since Count is an integer, and this might be considered "true" if it's anything other than 0; in fact, I don't even think there's a Count property on the Caption. You could loop through all of the columns and copy all of the header captions over, or you can access each column by key and copy it:
grid_step5.DisplayLayout.Bands(0).Columns(i2).Header.Caption = grid_step4.DisplayLayout.Bands(0).Columns(i2).Header.Caption