Hi,
I've ultrawebgrid in my application where i can copy data from Excel and paste in it therby for validation and submission.
I'm having 16 columns in the grid out of which, for 3 columns no data are entered in the grid as they re only read-only fields in the Ultrawebgrid.
So in Excel, I'm having data for only 13 columns and 3 other columns(read-only in the grid) are just hidden in Excel sheet.....
So when i copy these data from Excel and paste in the grid, I want the data from respective columns (in Excel) to get pasted in the respective columns in the grid::
How can i check this??? Can anyone help with this copy/paste operation????
Following is the updated code.
function UltraWebGrid1_BeforeClipboardOperation(gridName,operationType,options )
{
if(operationType != igtbl_ClipboardOperation.Paste)
return true;
}
var grid= igtbl_getGridById(gridName);
var band = grid.Bands[0];
var row = grid.getActiveRow();
var copiedData = igtbl_getClipboardData();
var copiedRows = copiedData.split('\n');
for(var rowI = 0; rowI < copiedRows.length; rowI++)
var copiedCellValues = copiedRows[rowI].split('\t');
if(copiedCellValues.length != 8)
if(row == null)
/*Ues return false if you dont want to create new rows here*/
row = igtbl_addNew(grid.Id,0,true,true);
var gridCellNum = 0;
var copiedValNum = 0;
while(copiedValNum < 8)
/*Paste if cell is not read only*/
if(band.Columns[gridCellNum].AllowUpdate != 2)
row.getCell(gridCellNum).setValue(copiedCellValues[copiedValNum++]);
gridCellNum++;
row = row.getNextRow();
Could you mark the answer as āVerifiedā if it works for you?
thnk u CMPM....
Yes tht wod also hold good as an addition ...
i mean if there are more no: of rows in Excel than grid and still we copy/paste....
Can u chnge the code now? as it's quite urgent ... thnk u
I am updating the code and post in some time but I need to know following.
What should happen if you copy 10 rows from excel and your grid only have 6 rows?
Should other 4 rows be newly created and inserted in the grid as new rows or they should be simply ignored?
Consider this:::
in Excel I'm having 5 rows each with sum no of columns (say a finite no: 10) and when i paste in the grid it's only the first row getting copied (as in the above code)...... now wat can i do to copy multiple rows each with value for the columns.........it's something to do with the split operation!!
and I should be able to paste in the grid.......
Does your paste insert new rows? Or it just replaces data in existing rows?