F
fd123456
Er... Sorry to interrupt, but you CAN put methods and functions in the
Global.asax file. You just have to make them static (Shared in VB).
You can even use functions normally not available outside of a page,
like LoadControl, like this :
in an aspx code-behind file, for instance in the Page_Load handler :
System.Web.UI.Page p = this;
bool IsLoaded = Global.GlobalMethod(ref p);
In the Global.asax file :
public static bool GlobalMethod(ref System.Web.UI.Page p)
{
p.LoadControl("mycontrol.ascx");
return (p != null);
}
(of course, you should use try/catch blocks and not check p against
null, but that was just for simplicity's sake).
So, yes, you can !
HTH,
Michel
Global.asax file. You just have to make them static (Shared in VB).
You can even use functions normally not available outside of a page,
like LoadControl, like this :
in an aspx code-behind file, for instance in the Page_Load handler :
System.Web.UI.Page p = this;
bool IsLoaded = Global.GlobalMethod(ref p);
In the Global.asax file :
public static bool GlobalMethod(ref System.Web.UI.Page p)
{
p.LoadControl("mycontrol.ascx");
return (p != null);
}
(of course, you should use try/catch blocks and not check p against
null, but that was just for simplicity's sake).
So, yes, you can !
HTH,
Michel