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

  • Home
  • SEARCH
  • 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 7810987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:59:35+00:00 2026-06-02T03:59:35+00:00

I am trying to add a object to my Html.Hidden HTML helper, but I

  • 0

I am trying to add a object to my Html.Hidden HTML helper, but I can’t get the syntax quite right.

Syntax 1:

@Html.Hidden("hiddenDate", ViewBag.myDate.ToString("dd.MM.yyyy"))

Results in runtime error and it can’t resolve the @Html.Hidden in view.

Syntax 2:

@Html.Hidden("hiddenDate", new { String = ViewBag.myDate.ToString("dd.MM.yyyy")})

Sets the value=”{ String = 16.04.2012 }”

I would like to get the value to only “16.04.2012”, but no success after several syntax tweaks

  • 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-02T03:59:37+00:00Added an answer on June 2, 2026 at 3:59 am

    Try casting the return value to object:

    @Html.Hidden("hiddenDate", (object)ViewBag.myDate.ToString("dd.MM.yyyy"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to add an object to NSMutableArray it seems to get duplicated. @interface
Trying to add a class object into a List using reflection, but when invoking
I am trying to add time to a Date object in javascript but am
I am trying to add a draggable object to to a simple html page.
I am trying to add html content to Solr with PECL. Unfortunately I can
I'm trying to add results from an object to newly created HTML elements: *long
I'm trying to add cards to an array in a Deck object but for
I am trying to add an object of the same class to a NSMutable
I'm trying to add new object to my ArrayList if it satisfy the condition.
I am trying to add the datetime object of a person. Whenever the birth

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.