I define a variable in a class, and initial it in Page_Load function.
Then I define another function in this class with [AjaxPro.AjaxMethod],
the problem is I can't use the variable, I wonder why.

The codes look like:

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class GisShow : System.Web.UI.Page
{
  private System.Random r = new Random();
  private int[] m_nErrArray;

  private void Page_Load(object sender, System.EventArgs e)
  {
     AjaxPro.Utility.RegisterTypeForAjax(typeof(GisShow));
     m_nErrArray = (int[])Application.Get("ErrArray");
  }

  [AjaxPro.AjaxMethod]
  public void InitLightInfo()
  {
     for ( int i = 0; i < m_nErrArray.Length; i++) // <- Error here
     {
         m_nErrArray[i] = r.Next(-1, 16);
     }
  }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

The error is: "Object reference not set to an instance of an object"

Anybody know the reasons of this error? And how can I use the variables
of the class?Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info/

Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---

Reply via email to