0

i call my server side method by jquery and from that method i am trying to access page control but gives error. here is my sample code

    [WebMethod]
    public static findEvents(string PID)
    {
        Page page = HttpContext.Current.Handler as Page;
        Panel pn=(Panel)page.FindControl("hdContainer");
    }

but find control gives null error. please give any solution to find control in static method.
  • I see that the OP has asked 8 questions till date and hasn't accepted a single answer. *Red-flag* – Sayan Dec 07 '12 at 05:32

1 Answers1

0

I have search something like this.

Static methods can not reference instance references. You will need to pass in a reference to the HttpContext or the page itself from some other instance method in the class. I think you need to call the static web service with a parameter like this:

[WebMethod]
public static findEvents(string PID, System.Web.UI.Page page)
{        
    Panel pn=(Panel)page.FindControl("hdContainer");
}

It may help you.

Azhar Mansuri
  • 665
  • 1
  • 7
  • 22
  • sorry , i wrote above in question by mistake but its not working , null exception. –  Dec 07 '12 at 06:43
  • Can you please show the aspx page which contains the code of panel and ajax request call code? so that we can identify the issue. – Azhar Mansuri Dec 10 '12 at 10:27