0

I have a problem with ajaxpro methods. In the .cs file I defined some global variable for my page, something like:

public partial class Admin : System.Web.UI.Page
{
    public int localidMember = 9;
    protected void Page_Load(object sender, EventArgs e)
    {

        AjaxPro.Utility.RegisterTypeForAjax(typeof(Admin));


        if (HttpContext.Current.Session["HomeOwn_ID"] != null)
        {
            localidMember = Convert.ToInt32(HttpContext.Current.Session["HomeOwn_ID"].ToString());

        }

    }


    [AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)]
    public string LoadInbox()
    {
        // I need to use the variable localidMember and expected that it will have the value that I have set to pageload.., but it didnt. The variable is reinitialized to 9... Anyone have any ideas what's going on... Thanks so much ! 
    }

}
user1507164
  • 81
  • 1
  • 4

2 Answers2

1

I think you can't do it; because, in AjaxPro, you can't deal with control properties.

Ben
  • 51,770
  • 36
  • 127
  • 149
Mario Soft
  • 61
  • 1
  • 8
0

AjaxMethod will have its own Context. Hence, localidMember will not be accessible inside it. You may consider passing it as a parameter.

KZee
  • 104
  • 1
  • 13