Hi Alphonse,
From your description, you means how to reference a page or user control
from another class, does the class you mean a utilitiy class which want to
be isolated with the web related infos?
If so, I think there are two means you can choose:
1. Define a function in the certain class which contains a param the type
of which is "Page" or "UserControl" then, you can reference the certain
Page or UserControl's members: For example:
public class ...
public void processPage(Page page)
{
page.XXX. = xxxx;
}
public void processUserControl(UserControl uc)
{
uc.xxxx = xxx;
}
2. In ASP.NET web applicatoin the HttpContext.Current static member provide
the reference to the current processed Request's Context and if the
request's handler is a Page handler(or other classes derived from
System.Web.UI.Page), we can use the HttpContext.Current.Handler to get the
Current Page's reference ,such as:
public void processPage()
{
Page page = (Page)HttpContext.Current.Handler;
page.XXX = xxx;
}
In addtion, here are some former threads discussing on the similar
questions:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=I5$opc
HGEHA.616%40cpmsftngxa06.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26ie%
3DUTF-8%26oe%3DUTF-8%26q%3Dasp.net%2Bpage%2Bfrom%2Bclass%2B%2Bsteven%2Bcheng
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=wAVBte%2
4CEHA.564%40cpmsftngxa06.phx.gbl&rnum=13&prev=/groups%3Fq%3D%2Bpage%2Bmember
%2Bsteven%2Bcheng%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26start%3D10%2
6sa%3DN
Hope also helps. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx