See following example:
public static class staticA
{
/// <summary>
/// Global variable storing important stuff.
/// </summary>
static string _importantData;
/// <summary>
/// Get or set the static important data.
/// </summary>
public static string ImportantData
{
get
{
return _importantData;
}
set
{
_importantData = value;
}
}
}
and in classB
public partial class _classB : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// 1.
// Get the current ImportantData.
string important1 = staticA.ImportantData;
// 2.
// If we don't have the data yet, initialize it.
if (important1 == null)
{
// Example code only.
important1 = DateTime.Now.ToString();
staticA.ImportantData = important1;
}
// 3.
// Render the important data.
Important1.Text = important1;
}
}
Hope, It helps.