I would somehow like to copy and paste the contents of an UltraWebGrid column to another column within the same grid. I'm using NetAdvantage 10.2. Can someone point me in the right direction if this is possible to do?
Hi megryan,
You could iterate through the rows of the grid and copy the values from one column to another:
protected void Button1_Click(object sender, EventArgs e)
{
foreach (UltraGridRow row in UltraWebGrid1.Rows)
row.Cells[2].Value = row.Cells[1].Value;
}
Another option would be to create a DataTable and write in it the values from a column you want. Then you can use this table to populate another column from the grid.
If you have any questions, please let me know.
Thank you for the tip Nikolay.
Thank you for your reply. Please feel free to contact us if you have any further questions regarding this matter.
I have successfully copied contents of one grid column (column 9) to another column (column 10) by using the following simple VB code:
With Me.MyGrid
For intRowCounter = 0 To (.Rows.Count - 1)
.Rows(intRowCounter).Cells(10).Text = .Rows(intRowCounter).Cells(9).Text
.Rows(intRowCounter).Cells(10).Value = .Rows(intRowCounter).Cells(9).Value
Next
End With
When I apply grid changes to the database, I use the UpdateCellBatch event. When I manually update cell contents one at a time and use the UpdateCellBatch event, all works well. However, when I change the contents of column 10 using the preceeding code, the database values do not change -- as if the UpdateCellBatch event does not recognize the cells as having changed. Is it possible to use the preceeding code with the UpdateCellBatch event, and if so what am I missing?
Thank you.
The UpdateCellBatch event is fired automatically on the first postback after a cell has been changed on the grid. Example of how to use this event can be found here - https://help.infragistics.com/Help/Doc/ASPNET/2011.1/CLR4.0/html/Infragistics4.WebUI.UltraWebGrid.v11.1~Infragistics.WebUI.UltraWebGrid.UltraWebGrid~UpdateCellBatch_EV.html.
Please let me know if this helps.
If you have any other questions please feel free to contact me.