K
Kris
Hi.
I have a asp class A with a public function AA()
----------------A.aspx.cs------------------------
public partial class A : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string AA()
{
return "AA";
}
}
---------------------------------------------------
I have also a user control which is on page A
---------------------WebUserConstrol.ascx.cs ------------------
public partial class WebUserControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
string B = ((A) this.Page)).AA();
}
}
-----------------------------------------------------------------
What I am trying to do is to call function AA from user control.
string B = ((A) this.Page)).AA();
but, during compilation I get error that
The type or namespace name 'A' could not be found (are you missing a
using directive or an assembly reference?)
What I am doing wrong?????? Default namespaces. Just simple application
with two pages and user control.
The funny thing is that code in page B compiles without problem.
Of course this type of casting doesn't make sense, but it works.
------------------------B.aspx.cs----------------------------
public partial class B : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string B = ((A)this.Page).AA();
}
}
I have a asp class A with a public function AA()
----------------A.aspx.cs------------------------
public partial class A : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string AA()
{
return "AA";
}
}
---------------------------------------------------
I have also a user control which is on page A
---------------------WebUserConstrol.ascx.cs ------------------
public partial class WebUserControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
string B = ((A) this.Page)).AA();
}
}
-----------------------------------------------------------------
What I am trying to do is to call function AA from user control.
string B = ((A) this.Page)).AA();
but, during compilation I get error that
The type or namespace name 'A' could not be found (are you missing a
using directive or an assembly reference?)
What I am doing wrong?????? Default namespaces. Just simple application
with two pages and user control.
The funny thing is that code in page B compiles without problem.
Of course this type of casting doesn't make sense, but it works.
------------------------B.aspx.cs----------------------------
public partial class B : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string B = ((A)this.Page).AA();
}
}