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 8330065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:00:18+00:00 2026-06-09T02:00:18+00:00

I thought it was a pretty simple issue, and I might be overthinking it,

  • 0

I thought it was a pretty simple issue, and I might be overthinking it, but I can’t figure out how to pass just a date string to my view. Here is the entity framework code first class:

public class Onus
{
public virtual int Id { get; set; }
public virtual string Title { get; set; }
[MaxLength(140)]
public virtual string Description { get; set; }
public virtual string Details { get; set; }
public virtual DateTime? DueDate { get; set; }
public virtual string Status { get; set; }
}

And here is the part of the controller where I want to change it:

public Onus GetOnus(int id)
{
var onus = db.Onuses.Find(id);

if (onus == null)
{
    throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
}
return onus;
}

In the view I am using some ajax and javscript templating to show the data. If you need that code to, I will add it.

***EDIT

Sorry for not being more clear, I don’t really have a controller manipulating this, it is all done with ajax:

var getOnus = function (id) {
            return $.ajax(onusApiUrl + "/" + id)
        };

var viewOnus = function () {
            var id = getId(this);
            onusServer.getOnus(id).done(viewOnusDetails);
        };

var viewOnusDetails = function (onus) {
            var output = templates.onusDetails(onus);
            $("#onusDetailsOutput").html(output);
        };

THere is a lot more javascript than that, but I believe that is all that you should need to see. Oh and the markup:

<div id="Details">
<div id="detailsLeft">
    <input type="hidden" value="{{Id}}" id="detailsId" />
    <header>
        <p><span class="onusTitleDetails">{{Title}}</span><span id="close">X</span></p>
    </header>
    {{#if DueDate}}
    <p class="detailsLabel">Due Date</p>
    <p class="onusDueDate">{{DueDate}}</p>
    {{/if}}
    <p class="detailsLabel">Description</p>
    <p class="onusDescriptionDetails">{{Description}}</p>
    <p class="detailsLabel">Details</p>
    <p class="onusDetails">{{Details}}</p>
</div>
<div id="detailAction">
    <div class="editOnus hover">Edit</div>
    <div class="deleteOnus hover">Delete</div>
</div>
</div>
<div class="onusStatusDetails">{{Status}}</div>
  • 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-09T02:00:19+00:00Added an answer on June 9, 2026 at 2:00 am

    What about adding another property to your entity, and then binding to that?

     public virtual DateTime? DueDate { get; set; }
    
     public string DueDateString
            {
                get { return DueDate != null ? DueDate.ToString() : string.Empty; }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought what I wanted would be pretty simple, but there must be something
OK so I thought this would be pretty simple but it's tripping me up..
Okay at first I thought this would be pretty straightforward. But I can't think
I thought this was pretty simple, but it doesn't seem to be working for
I thought this would be pretty simple, but it is proving a bit more
I thought this would be pretty simple to do but seems I must be
I am attempting to do what I originally thought would be pretty simple. To
I thought I was pretty well acquainted with Subversion, but now something I thought
I thought this would be pretty easy but I'm running into all sorts of
I'm creating a pretty simple form, and I'm running into an issue with Controls/components

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.