0

I am using a jqueryui button in my shared/_layout.cshtml for the login button. Below is the code for the click event. On clicking the button, I want the user to be transferred to the Logon view of the Account controller.

    $("#btnSignIn").click(function () {
            //alert("This is button on click event.");
            top.location.href = '<%= Url.Action("Logon", "Account"); %>'
        });

When debugging, I get the following error. I have looked around in SO for help for this.enter image description here

1 Answer 1

2

This is strange. If it's your _layout.cshtml, then you are using Razor.

For Razor, it should be:

$("#btnSignIn").click(function () {
        //alert("This is button on click event.");
        top.location.href = '@Url.Action("Logon", "Account")';
 });
Sign up to request clarification or add additional context in comments.

1 Comment

I am quite new to MVC, still working my way around with the syntaxes. Thanks your solution worked.

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.