0

I am beginner in asp.net mvc. I have in the view Home.cshtml

<a href="" style="color:blue; margin-top : 30px;">Créer un nouveau compte</a>

I'd like to associate this link to this action in the controller SuperController

public ActionResult Admin_creation()
        {
            return RedirectToAction("Admin_creation");
        }

How can i do this?

2 Answers 2

3

Use Url.Action or ActionLink:

 @Url.Action("Admin_Creation", "Super");

Or:

 @Html.ActionLink("Créer un nouveau compte", "Admin_creation");
2

Yes - you can use:

@Html.ActionLink("Text on screen", "Method name", "Controller name");

so going by your snippet above yours should read:

@Html.ActionLink("Créer un nouveau compte", "Admin_creation", "SuperController");

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.