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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:03:19+00:00 2026-06-09T06:03:19+00:00

I am creating an edit form for an Event data model in which the

  • 0

I am creating an edit form for an Event data model in which the input elements are populated with the Event properties for editing. After I finished populating the fields and formatting the page, I realised I had forgotten the form tags. After adding them in, my Razor code completely stops working, leaving all of the input elements empty. I have tried disabling various parts of the code, including all javascript and css and nothing seems to re-populate the fields except removing the form tags.

Here is the code:

@model Objects.Models.Event.Event

@using EventSignup.Extensions

@{
    ViewBag.Title = "Edit";
}

<script src="@Url.Content("~/Scripts/jquery-ui-1.8.22.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Javascript/jquery-ui-timepicker-addon.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Javascript/Edit.js")" type="text/javascript" ></script>

<h2>Edit</h2>

<div class="hero-unit">
<form action="" id="event_form" method="post">
    <label for="name">Event Name:</label>
    <input type="text" name="name" id="name" value="@Model.EventName" /><br />

    <label for="tickets"># of Tickets:</label>
    <input type="text" name="tickets" id="tickets" value="@Model.Tickets" /><br />

    <label for="location">Location:</label>
    <select name="location" id="location">        
        @foreach (var Element in ViewBag.Buildings as List<EventSignup.ViewModels.SelectElement>)
        {
            <option value="@Element.ID" @((Model.TicketsLocation.ID == @Element.ID) ? "selected='selected'" : "")>@Element.DisplayName</option>
        }
    </select><br />

    <label for="dates">Dates/Times:</label>
    @foreach (var EventInfo in Model.Dates)
    {
        <input type="text" class="date" name="dates" id="dates@(Model.Dates.IndexOf(EventInfo)+1)" value="@EventInfo.DateTime.ToDateTimePickerString()"/><br />
        if (EventInfo != Model.Dates.Last())
        {
            <label></label>
        }
    }
    <div id="date_inputs">
    </div>
    <label></label>
    <span id="new_date" class="fauxlink" onclick="newDate()">New Date/Time</span><br /><br />
    <input type="hidden" id="num_dates" value="@Model.Dates.Count" />

    <input type="submit" id="submit" value="Submit" /><br />
</form>
</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-09T06:03:21+00:00Added an answer on June 9, 2026 at 6:03 am

    Don’t use form elements directly – use the BeginForm HTML helper:

    @using (Html.BeginForm())
    {
    
    }
    

    You should also be using the template editors for the different model properties:

    @Html.EditorFor(model => model.EventName)
    

    Update:

    I normally find that Visual Studio/Razor will stop working (no intellisense for instance) if the markup is not valid (missing " at the end of an attribute, elements that are not properly closed etc…). Check your markup carefully to see where your have such an error.

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

Sidebar

Related Questions

I am creating a tool with which to edit web pages within a CMS.
I am creating a login register page which contains two edit text boxes(one for
I'm creating a web form, where in there are around 12-15 Input Fields... You
I'm creating an inline edit input['text'] snippet with jQuery. the html will be like
when creating a fairly complicated form that will be used to edit a database
[Edit] See this post as to why I'm declaring form elements globally. I chose
i have a small problem, i am creating a edit page in my asp.net
I am creating a rich edit text box like so: const char *testText =
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
I am trying to use a form class for add & edit. In add

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.