Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3801750
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:05:57+00:00 2026-05-19T14:05:57+00:00

Goal: I want to achieve two parameters (one string and one bool) to my

  • 0

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>


  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:05:58+00:00Added an answer on May 19, 2026 at 2:05 pm

    When you generate your action link:

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

    you should make sure that the pBlivenAdministrator parameter is assigned a value so that the generated HTML looks like this:

    <a href="/Admin/Anvandare_Listaa?pAnvandaren=abc&amp;pBlivenAdministrator=true">
        Some Text
    </a>
    

    If the request doesn’t contain the pBlivenAdministrator parameter you will be getting this exception. So it should be either:

    /Admin/Anvandare_Listaa?pBlivenAdministrator=true
    

    or:

    /Admin/Anvandare_Listaa?pBlivenAdministrator=false
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Goal: I want to achieve the path address, as string, of the application created
goal: I have the string 1234432144 I want to only replace the first 2
My goal is to actually achieve launching my ClickOnce application in one click (or
goal : I want to place a text after the submit button using hook_form_alter.
My Goal: i want to create an horizontal list of images. when mouse is
I've recently started my new private project. The main goal which I want to
I want to extract kernel symbols from a u-boot image The final goal is
I have the pages that I want to set as a goal in Google
My goal here is to make a button. I want the text to sit
Here's my list that I want to expand/collapse: My goal is simply to toggle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.