MVC : The parameters dictionary contains a null entry for parameter 'k' of non-nullable type 'System.Int32'

后端 未结 5 797
情书的邮戳
情书的邮戳 2020-12-05 17:08

I am new to MVC. In My Application , I\'m Retrieving the Data from Mydatabase. but when I run my Application it show Error Like This this is my url

<         


        
5条回答
  •  离开以前
    2020-12-05 17:48

    I am also new to MVC and I received the same error and found that it is not passing proper routeValues in the Index view or whatever view is present to view the all data.

    It was as below

    
                @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
                @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
                @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
            
    

    I changed it to the as show below and started to work properly.

    
                @Html.ActionLink("Edit", "Edit", new { EmployeeID=item.EmployeeID }) |
                @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
                @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
            
    

    Basically this error can also come because of improper navigation also.

提交回复
热议问题