G
Guest
Hello,
Well, the problem is clear: How to call a constructor of a programmaticaly
loaded user control?
The LoadControl function obviously won't do it. And using this:
<%@ Register TagPrefix="uc1" TagName="newcontrol" Src="newcontrol.ascx" %>
code behind:
Panel1.Controls.Add(new newcontrol("abc"));
newcontrol.ascx (constructor code):
public newcontrol(string _text)
{
Label1.Text = _text;
}
Will give me this failure on runtime:
Compilerfailure: CS1501: No overload for the method 'newcontrol' requires
'0' arguments
Line 31: private static bool __initialized = false;
Line 32:
Line 33: public newcontrol_ascx() {
Line 34: if ((ASP.newcontrol_ascx.__initialized == false)) {
Line 35: ASP.newcontrol_ascx.__initialized = true;
Note: I'm not using an English .net framework, the above compiler failure
message was originaly in German, it's just my translation of the original
German Text. The same original text in English might be different.
Well, the problem is clear: How to call a constructor of a programmaticaly
loaded user control?
The LoadControl function obviously won't do it. And using this:
<%@ Register TagPrefix="uc1" TagName="newcontrol" Src="newcontrol.ascx" %>
code behind:
Panel1.Controls.Add(new newcontrol("abc"));
newcontrol.ascx (constructor code):
public newcontrol(string _text)
{
Label1.Text = _text;
}
Will give me this failure on runtime:
Compilerfailure: CS1501: No overload for the method 'newcontrol' requires
'0' arguments
Line 31: private static bool __initialized = false;
Line 32:
Line 33: public newcontrol_ascx() {
Line 34: if ((ASP.newcontrol_ascx.__initialized == false)) {
Line 35: ASP.newcontrol_ascx.__initialized = true;
Note: I'm not using an English .net framework, the above compiler failure
message was originaly in German, it's just my translation of the original
German Text. The same original text in English might be different.