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

1
  • show the code where you have your RenderAction call. The context might have something to say. Commented Nov 11, 2011 at 13:55

1 Answer 1

8

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks that helped. Can you tell me what is the defference between those two than?
@Tromax Check out this SO question on the difference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.