Goal:

I want to achieve two parameters (one string and one bool) to my actionresult Anvandare\_Listaa.

```
    //
    // GET: /Admin/Anvandare_Listaa

    public ActionResult Anvandare_Listaa(string pAnvandaren, bool pBlivenAdministrator)
    {
        return View("Anvandare_Lista");
    }

```

Problem:  

Can't recieve bool value pBlivenAdministrator in my action result. I recieve error message.

> 
> The parameters dictionary contains a
>  null entry for parameter
>  'pBlivenAdministrator' of non-nullable
>  type 'System.Boolean' for method
>  'System.Web.Mvc.ActionResult
>  Anvandare\_Listaa(Boolean)' in
>  'BokButik1.Controllers.AdminController'.
>  An optional parameter must be a
>  reference type, a nullable type, or be
>  declared as an optional parameter.
>  Parameter name: parameters
> 
> 
> 

If I use bool? instead of bool I won't get any value. There is no problem when I use string, it is only problem related to bool in the action result.

```
public class MvcApplication : System.Web.HttpApplication
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

    }

    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        RegisterRoutes(RouteTable.Routes);
    }
}

```

---

```
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<BokButik1.ViewModels.AllaAnvandareViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Användare Lista
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Användare Lista</h2>

    <table>
    <tr>
        <th>Användare</th>
        <th>E-post</th>
        <th>Administratör</th>
    </tr>

<% foreach (var user in Model.AllaAnvandare) { %>

    <tr>
        <td>
            <%: user.Anvandaren %>
        </td>

        <td>
            <%: user.Epost%>
        </td>
        <td>
            <%: user.BlivenAdministrator %>
        </td>
        <td>

            <%: Html.ActionLink(Html.OmAdministratorBehorighet(user.BlivenAdministrator), 
                "Anvandare_Listaa", "Admin", new {pAnvandaren = user.Anvandaren, pBlivenAdministrator = user.BlivenAdministrator }) %>
        </td>
    </tr>

<% } %>
</table>

```

---