Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Thanks for all of your responses.</p> <p>Today i got the answer after googling for more than 1 hr.</p> <blockquote> <blockquote> <blockquote> <blockquote> <p>Things i learned is while sending json data using stringfy() method, in server side we need to define the parameter as object. not any other format like string/int/bla bla.....</p> </blockquote> </blockquote> </blockquote> </blockquote> <p>Actually there was a mistake on my Server side parameter.I modified it from string to object and it worked for me. Here i have defined my modified answer.</p> <pre><code> $('#btnResult').on('click', function () { var mydata = []; $("#&lt;%=GridProjectDetails.ClientID %&gt; tr").each(function () { var myObject = new Object(); var id = $(this).find("input[name*='ID']").val(); var locationcode = $(this).find("input[name*='TextLocationCode']").val(); var Location = $(this).find("input[name*='TextLocation']").val(); myObject.id = id; myObject.locationcode = locationcode; myObject.Location = Location; mydata.push(myObject); }); var myString = JSON.stringify({ details: JSON.stringify(mydata) }); alert(myString); var exportdata = myString; $.ajax({ type: "POST", url: "Default.aspx/ExportToExcel", data: exportdata, contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { $("#Result").text(data.d); }, error: function () { alert(arguments[2]); } }); }); }); </code></pre> <p>and my server side method should be </p> <pre><code>[WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public static string ExportToExcel(object details) { return "Message : Success"; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload