Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
Server Method Failed
posted
Hello, When i enter value in a grid cell, it shows - The server method 'GetValues' failed with the following error:System.NullReferenceException-Object reference not set to an instance of an object. my code is as follows - i call this method by javascript - PageMethods.GetCellValues(getValues,OnSucceeded); [System.Web.Services.WebMethod] public static string GetCellValues(string getBarcode) { string getValues = string.Empty; string cellValue = string.Empty; string[ splitCode = getBarcode.Split('|'); getBarcode = splitCode[0].ToString(); cellValue = splitCode[1].ToString(); if (getBarcode == "BarCode") { foreach (TransferDetail row in _gridTransferDetails) { if (row.BarCode.Trim() == cellValue.Trim()) { getValues = row.ItemCode + "|" + row.Description + "|" + row.Cost; break; } } } return getValues; } please reply me, Thanks in advance, Regards, Vasanth.
  • 28464
    posted

    Hello Vasanth,

    This one is hard to tell, since you are invoking a Web Service from the client to the server with javascript and Null Refrence can happen anywhere in the actual WebMethod. I can suggest placeing a breaking on the first line of the WebMethod body and tracing line by line until you see the dicrete line with the exception and the complete stack trace - this will surely provide additional clues.