How to get the Controller to pick up the "Linktext string" text from @Html.Actionlink

Asked

Viewed 59 times

1

In my application arose the need to make a same Controller call Sort has the Reclassification function, with this, I want the ControllerClassificar get the string LinkText of @Html.ActionLink to be able to control the visibility of some components HTML of my View, being columns of the existing table in the View Index and also control the visibility of some fields in the Views Insert, Details and Delete

Leaving thus the links:

@Html.ActionLink("**Classificação**", "Index", "Classificacao")

@Html.ActionLink("**Reclassificação**", "Index", "Classificacao")

I want my Controller take the value Classification and Reclassification and send via ViewBag to the Views and thus control the visibilities involved.

1 answer

2


You can make Actionresult accept a string parameter this way:

public ActionResult Classificacao(string name = null){

}

and Actionlink would be:

@Html.ActionLink("**Classificação**", "Index", "Classificacao", new{name = "**Classificação**"})
  • I did some tests here, and I’m seeing that it has to be in the POST method, how to pass without going by url ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.