Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
Unable to find template control after sorting
posted

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://es.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

Parents
  • 260
    posted

    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.

Reply
  • 16310
    Offline posted in reply to Bert Algoet

    Hello Bert,

    I have tested this using the sample from http://es.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.

    WDG_template_sort.zip
Children