Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8060965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:10:12+00:00 2026-06-05T10:10:12+00:00

In a View I send the model encoded like this: var model = ‘@Html.Raw(Json.Encode(Model))’;

  • 0

In a View I send the model encoded like this:

var model = '@Html.Raw(Json.Encode(Model))';

to a Controller Action. The model is a list of movies, and each movies contains a release Date.
This is the Controller action method

[HttpPost]
    public void createDoc(IEnumerable<Movie> movies)
    {
        //blablabla ...
        String date = "Date:" + movies.ElementAt(i).ReleaseDate + " ";
        //print date into a file
    }

When I print the date it is printed as Date:01/01/0001 00:00:00
The serialized data passed is shown with an alert and is printed as below:
“/Date(1070233200000)/”

Receveing a list of movies in the createDoc controller action, I think the problem is at the beginnig: it saves in a wrong format the Date so I can’t do anything to parse it in a right one.
My model Movie for the Date proprierty is:

[DataType(DataType.Date)]
public DateTime ReleaseDate { get; set; }

Do I have to change something in the model class to store the Data in the right format passing it from View post to Controller Action or can I do something before sending or after receiving json data to parse it?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:10:14+00:00Added an answer on June 5, 2026 at 10:10 am

    In your action method your assigning the date value to a String type so why not just use string.Format… something like:

    String date = string.Format("Date: {0:dd MM yyyy}", movies.ElementAt(i).ReleaseDate)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I send data to other view from controller? function index() { if(!empty($this->data))
I got a view model like this: public class BaseViewModelTech : INotifyPropertyChanged { static
I create view for register and send data to controller //app::import('Model','Myprofile'); Class MembersController extends
Question: How do send data to a view model when using command binding? So
I am trying to send a nsmutablearray from one navigational embedded view controller to
I want to send parameter from action to view which is not it's view,
I'm trying to send data to the Controller from the View. I have a
I have a array in controller I have to send it to view and
I want to do autopostback to dropdownlist. My form on view: @using (Html.BeginForm(Index, Model,
this is the method I want to send data to it function get_lesson($reshte,$poodeman){ $this->load->model('dropdown_model');

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.