Ask Your Question
1

How can a partial view be invoked from the _Layout.cshtml file?

asked 2023-06-15 15:44:05 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-15 16:07:01 +0000

scrum gravatar image

A partial view can be invoked from the _Layout.cshtml file using the syntax:

@Html.Partial("_PartialViewName")

where "_PartialViewName" is the name of the partial view file that you want to include in the layout.

You can also pass a model to the partial view as follows:

@Html.Partial("_PartialViewName", model)

where "model" is the data that you want to pass to the partial view.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-15 15:44:05 +0000

Seen: 8 times

Last updated: Jun 15 '23