Want to access non-static method from static method in asp.net c#.
private void nonstaicMethod(string var1)
{
//accessing the view/panel from the current page
//or using 'Response' to download a file
}
[System.Web.Services.WebMethod(EnableSession = true)]
public static void method1(string Id)
{
CurrentPageName cp=new CurrentPageName();
cp.nonstaicMethod();
}
For the downloading file, I got response is not available in this context
. I have tried,
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
`HttpContext context = HttpContext.Current`;
tried many ways when I gone through net. Nothing works.
When I tried to call nonstatic and accessing view/panel from the current page, I got Object reference not set to an instance of an object.