Reputation: 431
Hello i'm using this to get the value of a control but control collection is null:
Type type = BuildManager.GetCompiledType("~/Default.aspx");
Page pageView = (Page)Activator.CreateInstance(type);
Label lbl1 = (Label) pageView.FindControl("lbl1");
string lbl1Value = lbl1.Text;
If add a quick watch in Visual Studio i can see that PageView.Context has the value of the label, but PageView.Context is protected, so i don't know how to access it at runtime
Upvotes: 1
Views: 339
Reputation: 431
I've solved the problem, the page doesn't show controls value during reflection because i've setted the property autoevent wireup=false
Upvotes: 1