3

I have a problem while trying to render a partial action on my layout. On the line :

@{Html.RenderAction("Login");}

i get an error "CS1501: No overload for method 'Write' takes 0 arguments". I have tried also invoking the RenderPartial directly, with the same result... Can you tell me what is wrong?

The code of my partial view:

@model SikWebRole.Models.LogOnModel
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.LoginLink').click(function () {
            $('#loginForm').submit();
        });
    });
</script>
@using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { id = "loginForm" }))
{
<div class="loginBox">
    <div class="errorMsg">
        @Html.ValidationSummary(true, "Błędny login/hasło.")
    </div>
    <div class="loginHolder">
        <input type="text" class="textInput" name="UserName" value="Login" />
    </div>

    <div class="passwordHolder">
        <input type="text" class="textInput" name="Password" value="Hasło" />
    </div>
    <input name="RememberMe" style="display:none;" type="hidden" value="true"/>
    <a href="#" class="loginLink" ><span class="loginButton">Zaloguj</span></a>

    <ul><a href="#"><li class="registerLi">Zarejestruj</li></a><a href="#"><li class="RemindLi">Przypomnij hasło</li></a></ul>
</div>

}

The function used for render action:

public PartialViewResult Login()
    {
        return PartialView("LogOnForm", new SikWebRole.Models.LogOnModel());
    }

The partial view I want to render belongs to the "LogOn" method which is from the Account Controller, and the Login method is in the Picture Controller, maybe this is the reason?

I would be glad for all the answers.

Best Regards

As requested this is the code of my Layout.cshtml: http://pastebin.com/He2Rp5P4

tereško
  • 58,060
  • 25
  • 98
  • 150
domderen
  • 633
  • 9
  • 22

1 Answers1

8

In your cshtml file use @Html.Partial, not @Html.RenderPartial.

Becuzz
  • 6,846
  • 26
  • 39
  • Thanks that helped. Can you tell me what is the defference between those two than? – domderen Nov 11 '11 at 15:25
  • 2
    @Tromax Check out this [SO question](http://stackoverflow.com/questions/5248183/html-partial-vs-html-renderpartial-html-action-vs-html-renderaction) on the difference. – Becuzz Nov 11 '11 at 15:39