I have a WebMethod where I just want to flip a property to true.
I am putting it in the code-behind of a .aspx page using C#.
public partial class Data : Base
{
protected void Page_Load(object sender, EventArgs e)
{
this.bgc1.BGEnabled = false;
}
[WebMethod(EnableSession = true)]
public static void EnableBellows()
{
this.bgc1.BGEnabled = true;
}
}
I declare the property in the .ascx.cs file:
private bool _enabled = true;
public bool BGEnabled
{
get { return _enabled; }
set { _enabled = value; }
}
Lastly I call the WebMethod with a jQuery Ajax post.
I am getting the error that this
is not valid in a static property. This error is only in the WebMethod but not in the Page_Load.
My goal is to flip BGEnabled to true. If my approach is incorrect, what will I need to do differently? I need to be able to do it from an ajax post.