【问题标题】:Access JSON Stringified data on Server side在服务器端访问 JSON 字符串化数据
【发布时间】:2014-04-29 03:23:09
【问题描述】:

我想在服务器端使用 JSON 字符串化数组 ::

已发送字符串化数据的格式为::

task:[{"TaskID":4,"OwnerID":1,"RecurrenceID":null,"Title":"Test Title1234","Description":"Desc... ","Start":"2014-04-28T01:00:00.000Z","End":"2014-04-30T06:00:00.000Z","RecurrenceRule":"","RecurrenceException":"Task Exception Occured","IsAllDay":false}]

而在服务器端我试图访问的是::

public virtual JsonResult Test_UpdateSchedule(IList<SchedulerViewModel> task)
{
//Implementation Code
}

但我无法在此处访问它。

我的 ViewModel 格式如下::

 public class SchedulerViewModel 
    {
        public int TaskID { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public DateTime Start{get;set;}
        public DateTime End{get;set;}
        public string RecurrenceRule { get; set; }
        public int? RecurrenceID { get; set; }
        public string RecurrenceException { get; set; }
        public bool IsAllDay { get; set; }
        public int? OwnerID { get; set; }
        public string StartTimezone { get; set; }
        public string EndTimezone { get; set; }

    }

【问题讨论】:

  • 把你的 ui 也设置为它看起来没问题你是否使用 jquery ajax 请求传递?如果是这样,则存储到cookie中,然后在服务器端访问它.....

标签: jquery asp.net-mvc json asp.net-mvc-3 list


【解决方案1】:

确保您的请求是POST,并且您的内容类型是application/json

如果您发布您传递数据的方式可能有助于我们回答。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-01
    • 1970-01-01
    • 2014-07-08
    相关资源
    最近更新 更多