1

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,

Josh Mein
  • 28,107
  • 15
  • 76
  • 87
mc.parsa
  • 56
  • 1
  • 6
  • 1
    If I understand you correctly that you want to render the result of an action in a view, you should be using the existing `Html.Action()` or `Html.RenderAction()` as appropriate. – tvanfosson Nov 19 '11 at 14:19

1 Answers1

1

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

That's your problem. You should use:

htmlHelper.ViewContext.Writer
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928