Take the 2-minute tour ×

Problem: When I load the EditorTemplate for UserModel the UserRoles list does not generate a list of UserRole editors.

My models:

    public class UserSearchModel
    public Guid UserId { get; set; }
    [DisplayName("User Name")]
    public string UserName { get; set; }
    [DisplayName("User Roles")]
    public UserRoles UserRoles { get; set; }

    public partial class UserRoles : List<UserRole>


    public class UserRole
    public string RoleName { get; set; }
    public bool IsChecked { get; set; }
    public string Description { get; set; }

My editor Templates:

@model eGate.BackOffice.WebClient.Model.UserModel

@model eGate.BackOffice.WebClient.Model.UserRole

Actual Output Looks like:

User Name [ someuser ]


Expected Output:

User Name [ someuser ]


role1 [x] ischecked role for 1

role2 [x] ischecked role for 2

role3 [x] ischecked role for 3

share|improve this question
You need to provide more information. What is your EditorTamplate called, where did you put it? –  Erik Funkenbusch Sep 27 '11 at 20:05
add comment

3 Answers

You should just make the type List rather than deriving your own type.

share|improve this answer
add comment

I expect that the problem is the definition of UserRoles as a separate class. Try changing the property UserRoles in the UserSearchModel class to:

public List<UserRole> UserRoles { get; set; }

MVC is searching for a template for the UserRoles class. Since the template is for the UserRole class, MVC fails to find any template.


Also, I overlooked that you are using EditorFor for the UserRoles model. You should use EditorForModel like so:

@Html.EditorForModel(m => m.UserRoles)
share|improve this answer
Just for the sake of not ruling anything out I gave that a try. But still no dice. –  D.Forrest Sep 27 '11 at 21:42
add comment

This issue looks to be more likely caused by the fact the User EditorTemplate is being served up by the popUp window of a telerik mvc grid.

I have tested outside the grid popup to find that the templates work as expected. I will close this question and re-ask the correct question in another entry.

share|improve this answer
I had some problems with editor template and telerik as well, it wasn't generating the template while referenced inside the grid –  Tito Sep 26 '12 at 13:58
add comment

Your Answer


