I want to be able to share commonly used methods. In classic asp I would just make an inlcude file with whatever functions I wanted to be accessible anf the common function was directly accessible. When I try this in C#, it always retuns null, in other words, I can include the method, variable, array etc from one common methods page, but no value ever retuns on the page I want to view. Here is a simple example:
//this is the page I want to view
//this is the other page I set up for common methods
I have tried this by making the common methods page a web user control as well with the same result. Anyone know how to do this?
I don't know sir...I guess its broke.
//this is the page I want to view
Code:
namespace test
{
public class test3 : System.Web.UI.Page
{
protected common.WebForm1 userctrl;
private void Page_Load(object sender, System.EventArgs e)
{
string moon = userctrl.str1("thisisalongstring").ToString();
Response.Write(moon);
}
}
}
//this is the other page I set up for common methods
Code:
namespace test.common
{
public class WebForm1 : System.Web.UI.Page
{
public string str1(string wordtoevalualte)
{
string result = "";
if(wordtoevalualte.Length > 0)
{
result = "yes";
}
else
{
result = "no";
}
return result;
}
}
}
I have tried this by making the common methods page a web user control as well with the same result. Anyone know how to do this?
I don't know sir...I guess its broke.