Home mvc post dataset object
Reply: 0

mvc post dataset object

Cédric SICARD Published in 2017-09-14 10:26:17Z

I've want post to server my object that contains property as dataset

my model

public class MyModel
public string Title { get; set; } = "mytitle";
public DataSet Data { get; set; } 

in my view

<input type="hidden" id="myhidden" value="@JsonConvert.SerializeObject(Model,Newtonsoft.Json.Formatting.Indented)"/>

I want post this object to my controller

    url: myurl,
    contentType: 'application/json; charset=utf-8',
    type: 'POST',
    dataType: 'html',
    data: JSON.parse($('#myhidden').val())
    .success(function (searchResult) {
        my code....

My controller

public ActionResult MyAction(MyModel pObject)
    return PartialView();

pObject title property is ok but pobject data property don't contains my dataset

Is it possible ? Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.326772 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO