I created user control and want to add it to page. I use next code:
Controls_MultiTextInput cc = new Controls_MultiTextInput();
Controls.Add(cc);
But control doesn't appear on page. What is wrong?
I created user control and want to add it to page. I use next code:
Controls_MultiTextInput cc = new Controls_MultiTextInput();
Controls.Add(cc);
But control doesn't appear on page. What is wrong?
this.Controls.Add(this.LoadControl("MultiTextInput.ascx")) is the correct way to load the control because it needs to know where the ascx file is.
If you want to set properties, do this:
Controls_MultiTextInput cc = (Controls_MultiTextInput) LoadControl("MultiTextInput.ascx");
cc.MyProperty = "abc";
Controls.Add(cc);