[RESOLVED]showing a partial view in a diffrent view

hi!

I am building a website in asp.net mvc.

I wrote a Controller that returns a Partial view tha shows picture, by using the "return PartialView(Pview);"

the problem is that the pictures are showed in a new view, but i want that it will be shoed in the layout view.

how i do it?

return the src of the pictures instead of the view and modify the src of the pictures in the layout.

zag78

the problem is that the pictures are showed in a new view, but i want that it will be shoed in the layout view.

You can use @Html.Partial from other view to inject partial view markup in it.

Hi , Lets for e.g.

 I have a partial view : _ImageRender.cshtml

If you want to show your partial view in Layout ,

Please use @Html.Partial("_ImageRender")
in _Layout.cshtml

Don’t return PartialView("_ImageRender") from your Action result :)

Leave a Reply