How to set SelectList.DataValueField to whole object of List?
<p>I created 2 Html.DropDownList with Razor.</p>

<pre><code> &lt;p&gt;Category:&lt;/p&gt;
        @Html.DropDownList("Category", new SelectList(catList, "Id", "category"), "Select category");
        &lt;p&gt;SubCategory:&lt;/p&gt; 
        @Html.DropDownListFor(x=&gt;x.SubCategory, new SelectList(string.Empty, "Id", "Subcategory"), "Select sub category",new {id="subCategory" });
        @Html.ValidationMessageFor(x =&gt; x.SubCategory);
</code></pre>

<p>Model for second DropDownListFor looks like this.</p>

<pre><code>namespace OnlineShop.Models

{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    public partial class Product
    {
        public int Id { get; set; }
        [Required(ErrorMessage = "Enter name of product")]
        public string Name { get; set; }
        [Required(ErrorMessage = "Enter article of product")]
        public string Article { get; set; }
        [Required(ErrorMessage = "Enter description of product")]
        public string Description { get; set; }
        [Required(ErrorMessage = "Enter price of product")]
        public decimal Price { get; set; }
        [Required(ErrorMessage = "Select picture of product")]
        public byte[] Picture { get; set; }
        [Required(ErrorMessage = "Enter date of product")]
        public System.DateTime DateAdded { get; set; }
        [Required(ErrorMessage = "Choose subcategory of product")]
        public virtual SubCategory SubCategory { get; set; }//property that i want to associate with SelectList.DataValueField.
    }
}
</code></pre>

<p>then i created JSon result method.</p>

<pre><code>  public JsonResult GetSubs(int category)
    {
        List&lt;SubCategory&gt; subs = goods.SubCategorySet.Where(x=&gt;x.Category.Id==category).ToList();
        return Json(new SelectList(subs, "Id", "Subcategory")); //here is row of code that i want to change.
    }
</code></pre>

<p>how to set <code>SelectList.DataValueField</code> as  <code>SubCategory</code>,instead of <code>Id</code>?</p>