I'm using Infragistics version 8.2. I've got a web grid with some "fixed" columns. When I highlight a row and do a copy (Ctrl C) and paste it into a new empty row, it copies the Identity field info (which is hidden in the grid). And it shifts all the other data to the right by one column. I only mention that I have fixed columns because the copy places the data for the Identity column AFTER the fixed columns, even though it's the first field in the SQL select. I don't want the Copy to include the "Identity column" data at all. Is there a way to not include the Identity field data with a Copy (Ctrl C) without writing a lot of code? I'm very new to .NET programming and want to do this with the least amount of effort. Thanks.
Hi,
In the UltraWebGrid the columns are fixed to the left. In other words, when you fix a column that moves to the left most side and becomes the first column of the grid. If you fix another column after that, then it moves right next to the previous fixed column. All the other non-fixed columns get displayed after the fixed columns and the sequence columns retrieved from the SQL statement gets overridden. Hence the identity column which is the first retrieved column appears after the fixed column.
Now regarding the copying and pasting the row, I was wondering how it's getting the hidden column data. Here are few links on our online documentation regarding the clipboard functionality of WebGrid.
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR3.5/html/WebGrid_Using_Copy_Cut_and_Paste_Functionality.html
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR3.5/html/WebGrid_WebGrids_Clipboard_Functionality.html
Please visit the links and let me know if you have any questions or concerns.
Thanks
Thanks Sarita! That info helped a great deal. What I plan to do is to make the Identity field visible, but just make it so small (0 px wide) so it's not seen. However I do have another problem...
I can't get it to save without "manually" clearing out the Identity field on the new row that I pasted in. I need to do that programmically but I don't know how to reference the "new row id" and set that row's Identity field (the 1st column that I have made visible). Isn't there a row id for each grid row? And for a new row, isn't it 0? Keep in mind...I'm coding server side VB. Thanks.
The new row here means the row created after you click on the Add New Row Button, right? If so, then you can handle the event "AddRow" on server side and can access the row as follows.
Protected Sub UltraWebGrid1_AddRow(ByVal sender As Object, ByVal e As RowEventArgs)
Dim i As Integer = e.Row.Index
e.Row.Cells(0).Value = ""
End Sub
The client side event AfterRowInsert can also be handled for this purpose. To include the client side event handler, go to properties window for the Grid---> DisplayLayout --> ClientSideEvent --> AfterRowInsertHandler --> Add a new Handler. This will create the javaScript method signature in the Html mark up. The specific cell value can be accessed as follows:
function UltraWebGrid1_AfterRowInsertHandler(gridName, rowId, index)
{
var row = igtbl_getRowById(rowId);
var cell = row.getCellFromKey("EmpId");
cell.setValue("");
}
To learn more about the Client Side Object Model, please visit the link below:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WebGrid_CSOM_Overview.html
Hope this helps.
Sarita