K
Krzysztof Karnicki
Hi,
I've such a problem. I need to add my UserControl not on design time but on
Codebehind, so I prepare:
private void Page_Load(object sender, System.EventArgs e) {
MyUserControl myUserControl = new MyUserControl();
this.Controls.Add(myUserControls);
}
But actually that doesn’t work. After requesting my page on a browser, there
aren’t shown any controls putted on myUserControl. Also it is thrown an
exception of null reference if I tried to modify anything in codebehind of
components putted in myUserControl, when he is added in such a way. Any
suggestions ?
Regards
Krzysztof Karnicki
I've such a problem. I need to add my UserControl not on design time but on
Codebehind, so I prepare:
private void Page_Load(object sender, System.EventArgs e) {
MyUserControl myUserControl = new MyUserControl();
this.Controls.Add(myUserControls);
}
But actually that doesn’t work. After requesting my page on a browser, there
aren’t shown any controls putted on myUserControl. Also it is thrown an
exception of null reference if I tried to modify anything in codebehind of
components putted in myUserControl, when he is added in such a way. Any
suggestions ?
Regards
Krzysztof Karnicki