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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:24:11+00:00 2026-05-18T11:24:11+00:00

I have a strongly typed view in which the first line is; <%@ Page

  • 0

I have a strongly typed view in which the first line is;

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Employee.Master" 
Inherits="System.Web.Mvc.ViewPage<IEnumerable<SHP.Models.AnnualLeaveBooked>>" %>

To avoid Id collisions I want to display the collection in a grid so I use an editor template (one of the fields gets edited).
So in my code I put in the line;

    <%: Html.EditorFor(x => x) %>

And then in the EditorTemplate sub folder I put in this template;

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SHP.Models.AnnualLeaveBooked>" %>

        <tr>
            <td>
                <%: String.Format("{0:g}", Model.AnnualLeaveDate) %>
            </td>            
            <td>
                <%: Model.ApprovedStatus %>
            </td>
            <td>
                <%: Html.CheckBoxFor(model => model.CancelFlag) %>

                <%: Html.HiddenFor(model => model.AnnualLeaveBookedId) %>
            </td>
        </tr>

The problem I am having is that the EditorFor command does not seem to recognise the EditorTemplate.
What am I doing wrong?
Incidently I would be suprised if x => x is wrong, there is probably a better way to express this.

  • 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-18T11:24:11+00:00Added an answer on May 18, 2026 at 11:24 am

    Your editor template should be: ~/Views/Home/EditorTemplates/AnnualLeaveBooked.ascx where Home is the name of the controller. If it is a global editor template you could also put it in ~/Views/Shared/EditorTemplates/AnnualLeaveBooked.ascx. Notice the name of the editor template: it should be the same as your type name (AnnualLeaveBooked.ascx).

    Also instead of:

    <%: Html.EditorFor(x => x) %>
    

    you could:

    <%: Html.EditorForModel() %>
    

    Finally if you want to name your editor template with some custom name like ~/Views/Home/EditorTemplates/Foo.ascx you could specify this custom name:

    <%: Html.EditorForModel("Foo") %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If i have the following strongly-typed view: <%@ Page Title= Language=C# MasterPageFile=~/Views/Shared/Site.Master Inherits=System.Web.Mvc.ViewPage<XXX.DomainModel.Core.Locations.Location> %>
I have a strongly-typed MVC View Control which is responsible for the UI where
I have a asp.net mvc view which is strongly typed view and i have
I have a very simple viewmodel class, and a strongly typed view (which uses
I have a strongly typed view from which I want to insert some data.
There's no strongly typed View() method to return an ActionResult. So, suppose I have
I have the following code in a strongly-typed View in my application: <td> <label
Using EF4 Codefirst RC and MVC .NET I have a Strongly typed view I
I have a strongly typed user control (partial) and I'd like to be able
As the questions says I have always believed that a strongly typed list is

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.