Hello
I have a webdatagrid that uses a templatefield which contains a linkbutton. When i fill the grid i add a handler to the button in the initializeRow.
I have also added the sortingcode for templatefields with the help of this link http://ko.infragistics.com/community/forums/t/67075.aspx
The linkbutton works without a problem if you don't sort, the sorting works as well, however if you sort and then click the linkbutton the code in the initializerow can't find the control anymore. I use the following code to find the controle: e.Row.Items.FindItemByKey("Select").FindControl("btnSelect")
When you sort the same initialzerow is being run without a problem, it only happens when you click the linkbutton.
Any pointers would be very welcome
I have just noticed that it occurs on the other columns as well, so it's a general sorting issue i guess it doesn't have to do anything with the sorting of the templatefield, not sure what is going wrong.
Hello Bert,
I have tested this using the sample from http://ko.infragistics.com/community/forums/t/67075.aspx that you used to sort a template data field. I added the following code in the InitializeRow:
LinkButton button = (LinkButton)e.Row.Items.FindItemByKey("Template").FindControl("LinkButton1");
After sorting and clicking on a button this code worked fine and button was returning the given link button from the current row. I am attaching my sample for reference. Please test it on my side and let me kow how it behaves, or further modify it to reproduce the error you get.
I assume issue may be caused by the version used, so if you change the references in my sample and issue then occurs, then please let me know the exact version so that I can reproduce on my side and investigate.
I am glad your issue is resolved now.
If you want me to investigate this further for you please provide the whole code snippet where you change the ID and all the code inside InitialiazeRow event
Hi
I have found the problem, in the initializerow i changed the id of the linkbutton so i could use it as a unique identifier. When i leave the id alone everything works.
Im not sure though why this solved the problem though, because when i add the following code to your project it still works.
linkbtn.ID = "btn" & e.Row.Items.FindItemByKey("id").Value
Id rather know why it doesnt work, however i'm going to leave it at that since it works now and i havent got the time to look at the problem further.
Kind regards
Bert