TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
yash patel
1.5k
282
20.9k
The parameters dictionary contains a null entry for parameter 'id'
Oct 16 2020 4:43 AM
m getting the below error when I delete a record from the table in mvc
The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult DeleteUserDetails(Int32, nsroute.DataAccess.UserModel)' in 'nnnnn.Controllers.AccountController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters
This is a method for delete
public
static
int
DeleteUserDetails(
int
id )
{
int
rowAffected = 0;
using
(IDbConnection con =
new
SqlConnection(ConnectionString))
{
if
(con.State == ConnectionState.Closed)
con.Open();
DynamicParameters parameters =
new
DynamicParameters();
parameters.Add(
"@Id"
, id);
rowAffected = con.Execute(
"DeleteGroupMeeting"
, parameters, commandType: CommandType.StoredProcedure);
}
return
rowAffected;
}
This is the controller part
public
ActionResult DeleteUserDetails(
int
id,UserModel usermodel)
{
if
(UserModel.DeleteUserDetails(id)>0)
{
return
RedirectToAction(
"Dashboard"
,
"Home"
);
}
return
RedirectToAction(
"Dashboard"
,
"Home"
);
}
this is code for button
<a href=
"@Url.Action("
DeleteUserDetails
","
Account
", new {item.UserId})"
>Delete</a>
Reply
Answers (
1
)
getting network error
Develop Tabstrips and display details from database