vrijdag, mei 12, 2006

 

FindControl in PagerTemplate

When upgrading a CMS to multilanguage display, I stumbled upon a strange (bug?) thing. Using FindControl on the grid I wasnt able to find the control I was looking for#$@ My own recursive control search method didnt find it either. Time for a google shot. Here the solution:

instead of:
NO: myLabel = (Label)gridAllPages.FindControl("lblPagina");

use:
YES: myLabel = (Label)gridAllPages.BottomPagerRow.FindControl("lblPagina");

Another 'feature', you only can retrieve/set a HyperlinkField like this:

myField = (HyperLinkField)this.gridAllPages.Columns[3];

just a thing to remember@#! weird!

ref
http://forums.asp.net/1010797/ShowPost.aspx