how to pass Model and a parameter to mvc action method?

shijo stephen 21 Reputation points
2022-12-09T10:04:19.89+00:00

how to pass Model and a parameter to mvc action method?

@azzedinehtmlsql .ActionLink("X", "DeleteFile", "Application", new { m=Model, FilePath = fName.FilePath },null)

Developer technologies | ASP.NET | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-12-10T18:57:39.41+00:00

    An action link is just an anchor. Clicking an anchor causes a get and only query string parameters are supported. The object passed to the action link can only have simple properties, no complex types.

    If you need to a complex object, then create form, put all the model properties into hidden fields, and use a submit button instead of a link. The form can not be nested in another form, must be outside any other forms.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.