Monday, June 17, 2013

ASP.NET send/read JSON array via HiddenField

To send a JSON array in a postback, via hidden field, you can write this simple function. On the postback event you can read your HiddenField like this: Remember to reference the System.Web.Extensions.dll.
GridResponse class is declared as same structure of the JSON:

2 comments:

  1. I use in C#

    var json2 = JsonConvert.SerializeObject(listaCursos, Formatting.Indented, jsonSerializerSettings);
    formHiddenField2.Value = json2;

    How can I get hidden value using JQuery in client ?

    ReplyDelete