MVC 3 - View rendered on top of the layout page

249 Views Asked by At

I am having a problem rendering my view in the layout page using mvc 3.

When I render the result using a html helper, my output is on top of everything on the page, but I have used the following

HtmlHelper.ViewContext.HttpContext.Response

I extended the html helper to the RenderModule method which gives a module name and execute its ActionResult when I want to use it like this:

@Html.RenderModule("modulename")

It gives me the compile error

can not convert from void to html string

Therefore, I should use it like this:

@{ Html.RenderModule("modulename")}

However, it resulted in writing output on top of page.

What should I do?

Thanks in advance,

1

There are 1 best solutions below

0
Darin Dimitrov On BEST ANSWER

i have used the "htmlhelper.viewcontext.httpcontext.respone"

That's your problem. You should use:

htmlHelper.ViewContext.Writer