Hi
We are currently experiencing a problem with our grid control when a user switches their language to anything other than en-GB.
The problem is occurring when we hit the search button twice and the columns of the grid attempt to resize, using an auto resize JS function we have registered on the page. This function should resize the columns to the size of the values in the columns themselves.
I have attached the code I believe the problem exists. Can you provide a possible fix for this issue?
We are currently experiencing a problem with our grid control when a user switches their language to anything other than en-GB.
The problem is occurring when we hit the search button twice and the columns of the grid attempt to resize, using an auto resize JS function we have registered on the page. This function should resize the columns to the size of the values in the columns themselves.
I have attached the code I believe the problem exists. Can you provide a possible fix for this issue?
function AutoResizeColumns() { var gridMinWidth = 0; var grid = window['grid_' + '<%= grd.ClientID %>']; for (var i = 0; i < grid.MasterTableView.Columns.length; i++) { var maxColumnSize = 0; for (var j = 0; j < grid.MasterTableView.Rows.length + 1; j++) { var gridRow = j < grid.MasterTableView.Rows.length ? grid.MasterTableView.Rows[j].Control : grid.MasterTableView.HeaderRow; var textContent = ""; if (gridRow.cells[i].childNodes.length > 0 && (typeof gridRow.cells[i].childNodes[0].getElementsByTagName == "function" || typeof gridRow.cells[i].childNodes[0].getElementsByTagName == "object")) { var childNodes = gridRow.cells[i].childNodes[0].getElementsByTagName("span"); if (childNodes.length > 0) { textContent = childNodes[0].innerText; } } if (textContent != null) { var rowColLength = textContent.trim().length; if (rowColLength > maxColumnSize) { maxColumnSize = rowColLength; } } } if (maxColumnSize > 0) { gridMinWidth += (maxColumnSize * 7.5); grid.MasterTableView.ResizeColumn(i, maxColumnSize * 7.5); } else { gridMinWidth += 2; grid.MasterTableView.ResizeColumn(i, 2); } } document.getElementById(grid.ClientID).style.width = "100%"; document.getElementById(grid.MasterTableView.ClientID).style.width = "100%"; document.getElementById(grid.ClientID).style.minWidth = gridMinWidth + 100; document.getElementById(grid.MasterTableView.ClientID).style.minWidth = gridMinWidth + 100; }