Hi there,
I am having a strange bug with the IntializeRow event handler arguments.
I have a grid with custom sorting. In one of the cells of the grid, I put an image with an associated javascript in which one of the parameters is the e.Row.Index property of the RowEventArgs e. I use this to know on the browser javascript in which row the click was done.
This works fine except in one case: when the column I use for sorting has repeated elements. In this case, the InitializeRow fires for every row as expected, but the row number 0, for example, is not shown on the 0 position of the grid, but later. This breaks my program because when I click on the image of the cell, the javascript receives a row number of another row, and the results are completely unexpected.
I know it is hard to explain, let me know if I didn not made myself clear.
Any ideas on how to resolve this?
I made an example you can use too see what I mean.
You can download the web project here www.carrere.cat/GridTest.zip
To see how this is not working, open the web, click on the info images of every row to see that the rows are indexed correctly. After that, sort by status column and click on the info images to see that the row indexes are not corresponding to the actual row.
Pleas,e help us with this because this is completely breaking our sorting algorithm, since we sort correctly, but then the control renders every row where it wants.
I think that real issue is we don’t know the row’s Id in IntializeRow event using something like this e.Row.ClientID.
Still we can get the actual row in java script function as follow.
function Image_Click(sender)
{
var row = igtbl_getRowById(sender.parentNode.parentNode.id);
//row is the client side row object which contains image
//To avoid postback: return false
return false;
}
You need to change the image in following way.
<img src=”path” onclick=”BLOCKED SCRIPTreturn Image_Click(this)” />
Could you try this? Let me know if this works.