I implemented paste from Excel based on info from this forum. With latest version of RadGrid it does not work any longer. I am having trouble to fix it. Can you help, please?
function pasteFromExcel() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
//continue for IE
}
else {
jInfo("Paste from Excel works only in IE (due security policies of other browsers)","INFO")
}
if (!lastFocused) return;
var clipData = window.clipboardData.getData('Text');
var crlf = String.fromCharCode(13) + String.fromCharCode(10);
var table = clipData.split(crlf);
for (var tRow = 0; tRow < table.length - 1; tRow++)
table[tRow] = table[tRow].split(String.fromCharCode(9));
Array.remove(table, table[table.length - 1]);
fillTable(table);
$('#<%= lbtnSaveMarketAccessArea.ClientID %>').attr("class", "button3D_Yellow");
}
function fillTable(table) {
var pCell = lastFocused.parentNode;
var pRow = pCell.parentNode;
var pBody = pRow.parentNode;
var maxRows = pBody.rows.length;
var maxCols = pRow.cells.length;
for (var row = 0; row < table.length; row++) {
for (var col = 0; col < table[row].length; col++) {
var cCellIndex = pCell.cellIndex + col;
var cRowIndex = pRow.sectionRowIndex + row;
if (cRowIndex < maxRows && cCellIndex < maxCols) {
var cCell = pBody.rows[cRowIndex].cells[cCellIndex];
var pInput = cCell.getElementsByTagName("input")[0];
pInput.style.backgroundColor = "#F7FAFF";
pInput.value = table[row][col];
}
}
}
}