Hello,
I have a WebDataGrid control which contains both BoundDataFields and TemplateDataFields. Paging is enabled. Within the TemplateDataFields I have an image for Delete and an image for Edit. When the user clicks on the image I capture the cell id via the CellSelectionChanged event and then I edit or delete the row as appropraite. This all works perfectly when on the first page. However if the user navigates to the second page the CellSelectionChanged event does not pick up the ID of the selected row.
The code for the CellSelectionChanged event is below. When on the second page the e.CurrentSelectedCells.count = 1 but e.CurrentSelectedCells[0] is null? Any ideas?
if (e.CurrentSelectedCells[0] != null) {// Get the values we need from the selected row
GridRecordItem thisRecord = e.CurrentSelectedCells[0]; _selectedRowID =
Convert.ToInt32(thisRecord.Row.Items[0].Value); _selectedRowType = thisRecord.Row.Items[1].Value.ToString();
}
If it helps, I have a similar problem with the some result (i.e. CurrentSelectedCells has a length of 1 but the item it contains is null). This is in both ClientSide code and CodeBehind.
This first started showing up when I updated my development machine to Windows 8.1 which automatically updated me to IE11. At about the same time I updated the project to use the lastest ASP.NET 12.1.20121.1005 components. If I run IE11 in compatibility mode, or if I switch to non-IE browsers, or even IE9/10 the problem goes away.
I have other grids that do work, and am trying to find which setting is causing the problem.
Yes. The markup is below
="ID">
>
/>
="0%">
="10%">
="15%">
="7%">
Edit
Delete
Do you have the DataKeyFields property set? Setting it will ensure that the grid operates with the rows by its data key, not index.