Javascript – Function to convert GridView and Repeater in a JSON string


I need a JavaScript function which will take the ASP.NET Repeater as input. The function must then parse through the object and return the data in the rows of the object as JSON.

Then, I can send the JSON back to the server to be interpreted/parsed and saved to the DB.

Best Solution

your best bet is probably traversing the elements rendered by the Repeater and gathering the values into a javascript object. when you have that you can use json2's stringify() or jquery's serialize() or something similar to produce a json representation.