0
public class Clubber
{
    public virtual int ObjectID { get; set;}
    public virtual User OwnerUser { get; set; }
    public virtual int BlackPoint { get; set; }
    public virtual bool ToSendSMS { get; set; }
}

and

public class User
{
    public virtual int ObjectID {get; set;}

    [Required]
    public virtual Permission Permission { get; set; }
}

and i try to make Dropdown list for the OwnerUser property by the ObjectID

@Html.DropDownList("OwnerUser.ObjectID", (SelectList)ViewBag.OwnerList)

and when I try to save its says that Permission Required how can i disable the permission validation in this case?

stiank81
  • 25,418
  • 43
  • 131
  • 202
dor
  • 105
  • 9

2 Answers2

1

I will suggest to use ViewModel which will have required fields to render on UI and may be specific to you Controller - Action.

see this SO link on best practices of using ViewModel -

Community
  • 1
  • 1
swapneel
  • 3,061
  • 1
  • 25
  • 32
0

Use following in action.

[Bind(Exclude = "Permission")] 

To exclude multiple attribute, you can do

 [Bind(Exclude = "attribute1,attribute2,attribute3")] 
  • @dor: You can exclude more than properties using comman after each attribute name like [Bind(Exclude="OBJECTID,Permission")] –  Mar 01 '12 at 11:33