this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Showing posts with label Asp.net MVC. Show all posts
Showing posts with label Asp.net MVC. Show all posts

Friday, September 7, 2012

Html.RenderPartial() Sytanx Error : No overload for method 'Write' takes 0 arguments

Hey Everyone,

I was trying Html.RenderPartial() in Asp.net MVC and what I got “No overload for method 'Write' takes 0 arguments“

From my code it seems very clear that I have written correct syntax but actually there is a little problem with it.

My earlier code was is as below

@foreach (var p in Model.Members)

{

@{ Html.RenderPartial("MemberSummary",m); }

}

But it was giving me Error : “No overload for method 'Write' takes 0 arguments”. As we all know RenderPartial() directly writes in the output stream so it was better for using it than Partial().

After close look inside of code, I found that it should be C# statement and I was mixing inside of code block and I corrected out my code as below. It worked.

@foreach (var p in Model.Members)

{

Html.RenderPartial("MemberSummary", m);

}

Have a happy debugging !!