0

I using jquery ajax to send data to code behind....

$.ajax({
type: 'POST',
url: 'Epad.aspx/generateReport',
data: "{'exportOptions':" + JSON.stringify( exportOptions ) + "}",
contentType: 'application/json; charset=utf-8',
dataType: 'json',
async: true,

cache: false, });

I calling WebMethod....

public static  void generateReport(dataReportEpad[] exportOptions) {....}

In the WebMethod I need access to C# Gridview and some TextBox that are inside the Gridview....

How can I do it?

gvd
  • 1,482
  • 6
  • 32
  • 58
  • Wrong question. I think you are confusing the concepts. Even if you could access GridView nothing will happened on the page. – Dalorzo Dec 26 '13 at 19:17

1 Answers1

0

The short answer is you can't access controls in WebMethods.

I found this link where this same question was already posted:

Accessing ASP control from webmethod

Community
  • 1
  • 1
Dalorzo
  • 19,834
  • 7
  • 55
  • 102
  • Thanks.. Now I understand that I can't access to Controls from WebMethod... But Are there another solution to pass values to code behind and are able to access to the Controls...? – gvd Dec 26 '13 at 19:38
  • For asp.net the simplest way is using an update panel. You can find additional help here: http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/ – Dalorzo Dec 26 '13 at 20:07