Wednesday, October 3, 2012

Getting the Repeater row index from the LinkButton


This is one I am posting for my own reference so I can find it easier...  When Clicking a LinkButton in a Repeater, I needed the index available to modify a cached DataTable.

Situation:  Getting the Repeater row index from the LinkButton

Solution:

        LinkButton lnkButton = sender as LinkButton;
        int RepeaterItemIndex = ((RepeaterItem)lnkButton.NamingContainer).ItemIndex;

Credit to kaushalparik27 at http://forums.asp.net/t/1333400.aspx/1

No comments:

Post a Comment