Author: lenvia | Posted on: 8/13/2009 9:29:34 AM | Views : 425

Hello guys, I don't know if it's possible but I want to modify the Text property for multiple labels with a routine. The Labels ID matches an ID in a DB. I have an array for each Label.ID. With a foreach I am able to get the correct data. What I wish to do is with the ID stored in the array modify the text property. But for some reason I get a null reference when using FindControl(). I have a Master Page, so I drilll down from the Container to the actual Control name, still can't reach the obect.
foreach (var register in parameters) { theData.SearchInvData = register; Label lb = (Label)(FindControl(register)); //returns null Label lb2 = (Label)(FindControl("Container1").FindControl("actualCont").FindControl(register)); //Null Reference Exception lb.Text = theData.InvValueData; ...

Go to the complete details ...