P
patrick.tsang
Hi guys,
I try to load a user control by using Page.LoadControl.
// in aspx page
Control l_oControl = Page.LoadControl("~/Controls/ucA.ascx");
ucA myUserControl = (ucA)l_oControl;
myUserControl.Name = "Hello world";
// in ascx ucA
public string Name
{
set {m_sName = value;}
}
I used this in .NET 1.1 and it works fine. But when i wrote the code in
the .NET 2.0 then i am not able to get ucA class properties, pretty
much give me exception for the casting from l_oControl to ucA. Any
idea?
Cheers,
Patrick
I try to load a user control by using Page.LoadControl.
// in aspx page
Control l_oControl = Page.LoadControl("~/Controls/ucA.ascx");
ucA myUserControl = (ucA)l_oControl;
myUserControl.Name = "Hello world";
// in ascx ucA
public string Name
{
set {m_sName = value;}
}
I used this in .NET 1.1 and it works fine. But when i wrote the code in
the .NET 2.0 then i am not able to get ucA class properties, pretty
much give me exception for the casting from l_oControl to ucA. Any
idea?
Cheers,
Patrick