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 8531323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:27:28+00:00 2026-06-11T09:27:28+00:00

how can i pass the arguments when i did a redirection by a button:

  • 0

how can i pass the arguments when i did a redirection by a button:

  • when i call the method afficher it needs arguments how can i add it
  • how can i pass the values of the editor-field like the arguments of afficher()

file:Index.cshtml

<body  onload="initialize()">


<div id="map_canvas" style="width: 800px; height: 500px;"></div>
@using (Html.BeginForm("Afficher", "Historique"))
{
    <div>
        <fieldset>
            <legend>Tracking Information</legend>

            <div class="editor-label">
               <label  title= "jour " runat="server" >             day of begin                 </label>
               </div>
                <div class="editor-field">
               <input id="day_begin" name= "day_begin" />
               </div>
               <div class="editor-label">
             <label  title= " heure " runat="server" >              hour of begin                 </label>
             </div>
             <div class="editor-field">
             <input id="hour_begin" name= "hour_begin" />
             </div>
             <div class="editor-label">
             <label  title= " minute " runat="server" >              minute of begin              </label>
             </div>
             <div class="editor-field">
             <input id="minute_begin" name= "minute_begin" />
             </div>
             <div class="editor-label">
             <label  title= " jour " runat="server" >                day of end                 </label>
             </div>
             <div class="editor-field">
              <input id="day_end" name= "day_end" />
              </div>
                <div class="editor-label">
             <label  title= " heure " runat="server" >               hour of end                 </label>
             </div>
              <div class="editor-field">
               <input id="hour_end" name= "hour_end" />
               </div>
               <div class="editor-label">
             <label  title= " minute " runat="server" >              minute of end              </label>
            </div>
            <div class="editor-field">
               <input id="minute_end" name= "minute_end" />
               </div>





            <p>
                <input type="submit" value="Done" runat="server" />
            </p>
        </fieldset>
    </div>
}
@using (Html.BeginForm())
{
    <div>
        <fieldset>
            <legend>Result</legend>

            <table id ="table 1" runat="server" ></table>



    </div>
    }

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Lay2.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">

    function initialize() {
        var myLatLng = new google.maps.LatLng(36.802584, 10.108191);
        var myOptions = {
            zoom: 30,
            center: myLatLng,
            mapTypeId: google.maps.MapTypeId.TERRAIN
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"),
         myOptions);
        var flightPlanCoordinates = [
         new google.maps.LatLng(36.802584, 10.108191),
         new google.maps.LatLng(36.801897, 10.102955),
         new google.maps.LatLng(36.802275, 10.110788),
         new google.maps.LatLng(36.805024, 10.109049)
         ];
        var flightmarker = new google.maps.Marker({
            position: new google.maps.LatLng(36.802584, 10.108191),
            map: map,
            title: " denden"
        });

        var flightPath = new google.maps.Polyline({
            path: flightPlanCoordinates,
            strokeColor: "#FF0000",
            strokeOpacity: 1.0,
            strokeWeight: 2
        });
        flightPath.setMap(map);
    }





</script>

</body>

the file HistoriqueController.cs:

public ActionResult Afficher(int b1,int b2, int b3, int e1, int e2, int e3)
         {
             double d1 = b1 * 10000 + b2 * 100 + b3;
             double d2 = e1 * 10000 + e2 * 100 + e3;
             ViewBag.Title = (d2 - d1).ToString();
             Parcours p = new Parcours(d1, d2);
             var model = p._segments;

             return View(model);
         }

i have the error :

The parameters dictionary contains a null entry for parameter 'b1' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Afficher(Int32, Int32, Int32, Int32, Int32, Int32)' in 'MvcApplication7.Controllers.HistoriqueController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Nom du paramètre : parameters
  • 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-06-11T09:27:29+00:00Added an answer on June 11, 2026 at 9:27 am

    The MVC Model Binder will look for values wherever it can find them, but all non-nullable parameters in the action method have to be set somehow, or you will get the exception you see.

    You could add these parameters inside the form, like this (hidden or user input types):

    @using (Html.BeginForm("Afficher", "Historique"))
    {
        <fieldset>
            <legend>Tracking Information</legend>    
            <input id="b1" name= "b1" type="text" /> 
            <input id="b2" name= "b2" type="text" /> 
            <input id="b3" name= "b3" type="text" /> 
    
            <input id="e1" name= "e1" type="hidden" value="1" /> 
            <input id="e2" name= "e2" type="hidden" value="2" /> 
            <input id="e3" name= "e3" type="hidden" value="3" /> 
       <!-- etc -->
    }
    

    Or, if the parameters are optional, then you can make them nullable in the action method:

    public ActionResult Afficher(int? b1, int? b2, int? b3, int? e1, int? e2, int? e3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know you can pass arguments through the RunWorkerAsync function call when you first
Can i pass strings as arguments during method.Invoke(objectname,object[]params) for a method of signature Getdetails(int,string,bool)
You can pass special strings into jQuery's Datepicker class setDate() method like +7 which
In mvc, you can pass arguments like so new { A = B, C=
Is there any way that I can pass arguments in selector? example: I have
In Visual Studio Debug part, we can pass arguments. I want to know how
How can I pass arguments to my lua dll function? I made a simple
How can I pass back some arguments from a window that is closed? For
I noticed today that I can't use * to pass width or precision arguments
I have a process that needs to call a method and return its value.

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.