Lamloumi Afif
Lamloumi Afif

Reputation: 9081

Asp Mvc Redirect Controller

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?

Upvotes: 0

Views: 109

Answers (2)

Ctrl_Alt_Defeat
Ctrl_Alt_Defeat

Reputation: 4009

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");

Upvotes: 2

Darren
Darren

Reputation: 70718

Use Url.Action or ActionLink:

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

Or:

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

Upvotes: 3

Related Questions