Passing multiple results back in URL from view to controller with MVC from wrapped selectViewList
<p>I am currently working on populating two dropdown lists in the view with a single submit button that will pass through the selections. However the parameters in the url are getting returned as null when accessed through the method though i can see it populated in the string:</p>

<p>Expected URL:
<a href="http://localhost:8080/store/DisplaySelection?firstId=item1&amp;secondId=item+2" rel="nofollow">http://localhost:8080/store/DisplaySelection?firstId=item1&amp;secondId=item+2</a></p>

<p>But the URL I'm getting is:
<a href="http://localhost:8080/store/DisplaySelection?firstList.firstId=item+1&amp;secondList.secondId=item+2" rel="nofollow">http://localhost:8080/store/DisplaySelection?firstList.firstId=item+1&amp;secondList.secondId=item+2</a></p>

<p>The controller method that is accessed when the submit button looks like this:</p>

<pre><code>    public ActionResult DisplaySelection(string CatId, string BrandId)
    {
        ViewBag.catId = CatId;
        ViewBag.brandId = BrandId;
        return View(ViewBag);
    }
</code></pre>

<p>The change of the name is due to when I'm passing the data held in the dropdown to the view, since i have two lists of data, I have a wrapped class so i have to select he correct list to display before i can use the data.</p>

<p>And example would be:</p>

<pre><code>public class SecondDropDownViewModel
{
    public string secondId { get; set; }
    public IEnumerable&lt;SelectListItem&gt; List { get; set; }
    public static List&lt;SelectListItem&gt; BuildSecondList(IEnumerable&lt;Dtos.Second&gt; second)
    {
        List&lt;SelectListItem&gt; items = new List&lt;SelectListItem&gt;();
        items.Add(new SelectListItem { Text = "item 1", Value = "itemd 1"
        items.Add(new SelectListItem { Text = "item 2", Value = "itemd 2"
        items.Add(new SelectListItem { Text = "item 3", Value = "itemd 3"

        return items;
    }
}

public class FirstDropDownViewModel
{
    public string firstId { get; set; }
    public IEnumerable&lt;SelectListItem&gt; List { get; set; }
    public static List&lt;SelectListItem&gt; BuildFirstList(IEnumerable&lt;Dtos.First&gt; first)
    {
        List&lt;SelectListItem&gt; items = new List&lt;SelectListItem&gt;();
        items.Add(new SelectListItem { Text = "item 1", Value = "itemd 1"
        items.Add(new SelectListItem { Text = "item 2", Value = "itemd 2"
        items.Add(new SelectListItem { Text = "item 3", Value = "itemd 3"

        return items;
    }
}

public class DropDownViewModel
{
    public FirstDropDownViewModel firstList { get; set; }
    public BrandDropDownViewModel secondist { get; set; }
}
</code></pre>

<p>Controller:</p>

<pre><code>public ActionResult Index()
{ DropDownViewModel vm = new DropDownViewModel();

        vm.firstList = new FirstDropDownViewModel
        {
            List = FirstDropDownViewModel.BuildFirstList()

        };
        vm.secondList = new SecondDropDownViewModel
        {
            List = SecondDropDownViewModel.BuildSecondList()
        };
        return View(vm); }
</code></pre>

<p>View: </p>

<pre><code>@using (Html.BeginForm("DisplaySelection", "store", FormMethod.Get)){
&lt;fieldset&gt;
        Grade Type
        @Html.DropDownListFor(m =&gt; m.firstList.CatId, Model.firsList.List, "--Select Category--")
        @Html.DropDownListFor(m =&gt; m.secondList.BrandId, Model.secondList.List, "--Select Brands--")
        &lt;p&gt;
            &lt;input type="submit" value="Submit" /&gt;
        &lt;/p&gt;
    &lt;/fieldset&gt;
}
</code></pre>