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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:18:20+00:00 2026-05-14T06:18:20+00:00

I have this <%=Model.StartDate%> <%=Html.Hidden(StartDate, Model.StartDate)%> it outputs: 2010-05-11 11:00:00 +01:00 <input type=hidden value=2010-03-17

  • 0

I have this

<%=Model.StartDate%>
<%=Html.Hidden("StartDate", Model.StartDate)%>

it outputs:

 2010-05-11 11:00:00 +01:00      
 <input type="hidden" value="2010-03-17 11:00:00 +01:00" name="StartDate" id="StartDate"> 

What the…

It’s a paging mechanism so the hidden value was valid on the first page and I’ve been able to move forward to the next page. But since the values won’t update properly it ends there.

What do I need to do?

Using firefox.

Update – more code

using (Html.BeginForm("Program", "Activities", null, FormMethod.Get, new { @name = "ProgramForm", id = "ProgramForm" }))
{ 

.

        viewModel.StartDate = pagingService.StartDate;
        return View(viewModel);

Update – complete action

    [Authorize]
    public ActionResult Program(string[] submit)
    {
        var viewModel = new ActivityProgramViewModel { UserID = LoggedInUser.UserID };
        viewModel.Fresh = true;

        TryUpdateModel(viewModel);

        var pagingService = new OccurencePagingService(LoggedInUser.AllActivities.Where(a => a.StartTime != null));

        if (!viewModel.Fresh)
        {
            pagingService.StartDate = ((DateTimeOffset)viewModel.StartDate);
            pagingService.EndDate = ((DateTimeOffset)viewModel.EndDate);
        }

        if (submit != null)
            if (submit.Contains("MoveBack"))
                pagingService.MoveBack();
            else if (submit.Contains("MoveForward"))
                pagingService.MoveForward();

        ViewData.Model = viewModel;

        viewModel.Occurrences = pagingService.GetOccurences();
        viewModel.Fresh = false;

        viewModel.HasLess = pagingService.HasLess;
        viewModel.HasMore = pagingService.HasMore;

        viewModel.StartDate = pagingService.StartDate;
        viewModel.EndDate = pagingService.EndDate;

        return View();
    }
  • 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-05-14T06:18:20+00:00Added an answer on May 14, 2026 at 6:18 am

    I think the <%=Html.Hidden(“StartDate”, Model.StartDate)%> is out of place here.

    Html Helpers try to keep data in the UI like they where entered by examining the post/route data. Please dont ask me how someone would ever enter data in a hidden field.

    You want something different: You want to set the data to Model.StartDate and dont care what is in the post/route.

    I would use <input value="<%=Model.StartDate%>" name="StartDate" /> .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have model like this: class Kaart(models.Model): name = models.CharField(max_length=200, verbose_name=Kaardi peakiri, help_text=Sisesta kaardi
I have an ascx page which contains the following line: <%= Html.TextBox(DayOfWeek, Model.JourneyBooking.StartDate.DayOfWeek.ToString(), new
I have this model in django: class JournalsGeneral(models.Model): jid = models.AutoField(primary_key=True) code = models.CharField(Code,
Let's say I have this model named Product with a field named brand .
I'm using FluentNHibernate but NHibernate XML will do. Say I have this model public
I have this Task model: class Task < ActiveRecord::Base acts_as_tree :order => 'sort_order' end
I have this dictionary in my apps model file: TYPE_DICT = ( (1, Shopping
I have a model that holds user address. This model has to have first_name
Okay so I have this mode: class Posts(db.Model): rand1 = db.FloatProperty() #other models here
i have this in my BlogRepository public IQueryable<Subnus.MVC.Data.Model.Post> GetPosts() { var query = from

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.