To convert a able to json, You Can serialize dt to json and put it into the hidden control hidBoundary at the front end. The specific implementation is as follows, if you have similar requirements, refer to section 1. serialize dt into json and put it in the hidden control "hidBoundary" at the front end:
The Code is as follows:
String json = JsonConvert. SerializeObject (dtTemp );
This. hidBoundary. Value = json;
Newtonsoft. Json. dll needs to be referenced
2. obtain data in dt from the hidden space in the foreground
The Code is as follows:
Var boundaryDiv = $ ('# hidBoundary ');
If (boundaryDiv! = Undefined & boundaryDiv. length! = 0)
{
Var jsonString = boundaryDiv. val ();
_ JsonBoundary = jQuery. parseJSON (jsonString );
}
The parseJSON method of jQuery is used to parse data into json format.
And vice versa. If you want to convert the foreground json data to the background DataTable, use the opposite method.