DylanJones1
asked on
Getting Property Value of BasePage to a Static Method
I have a static page method I am calling from a javascript function. I need to check the DityFlag for the page. Since it is a Staic this.dirty will not work. How can I check the dirty flag from within this static method.
ASKER
OK...
MyBasePage
// The dirty state flag for data change checking
private bool isDirty;
/// <summary>
[Browsable(false)]
public bool Dirty
{
get { return isDirty; }
set { isDirty = value; }
}
MyRealPage : BasePage
[System.Web.Services.WebMe thod]
public static void SetData()
{
if (ServiceReceipt.Dirty)
{
If ( MyRealPage.Dirty)
{
DoMyFunction();
}
}
So how should this look?
MyBasePage
// The dirty state flag for data change checking
private bool isDirty;
/// <summary>
[Browsable(false)]
public bool Dirty
{
get { return isDirty; }
set { isDirty = value; }
}
MyRealPage : BasePage
[System.Web.Services.WebMe
public static void SetData()
{
if (ServiceReceipt.Dirty)
{
If ( MyRealPage.Dirty)
{
DoMyFunction();
}
}
So how should this look?
ASKER
Sorry had some typos...
MyBasePage
// The dirty state flag for data change checking
private bool isDirty;
/// <summary>
[Browsable(false)]
public bool Dirty
{
get { return isDirty; }
set { isDirty = value; }
}
MyRealPage : MyBasePage
[System.Web.Services.WebMe thod]
public static void SetData()
{
If ( MyRealPage.Dirty)
{
DoMyFunction();
}
}
So how should this look?
MyBasePage
// The dirty state flag for data change checking
private bool isDirty;
/// <summary>
[Browsable(false)]
public bool Dirty
{
get { return isDirty; }
set { isDirty = value; }
}
MyRealPage : MyBasePage
[System.Web.Services.WebMe
public static void SetData()
{
If ( MyRealPage.Dirty)
{
DoMyFunction();
}
}
So how should this look?
It should look like this
// The dirty state flag for data change checking
private static bool isDirty;
/// <summary>
[Browsable(false)]
public static bool Dirty
{
get { return isDirty; }
set { isDirty = value; }
}
// The dirty state flag for data change checking
private static bool isDirty;
/// <summary>
[Browsable(false)]
public static bool Dirty
{
get { return isDirty; }
set { isDirty = value; }
}
ASKER
And how would this we accessed in the staic method
[System.Web.Services.WebMe thod]
public static void SetData()
{
If ( MyRealPage.Dirty)
{
DoMyFunction();
}
}
And also set on the page itself as I can no longer use this.Dirty = true;
[System.Web.Services.WebMe
public static void SetData()
{
If ( MyRealPage.Dirty)
{
DoMyFunction();
}
}
And also set on the page itself as I can no longer use this.Dirty = true;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Bug
So make your property static.
Then you can access it in the following way.
ClassName.DirtyFlag