How to use MVC 3 @Html.ActionLink inside c# code

前端 未结 5 1035
庸人自扰
庸人自扰 2021-01-17 09:59

I want to call the @Html.ActionLink method inside a c# function to return a string with a link on it.

Something like this:

string a = \"Email is lock         


        
5条回答
  •  星月不相逢
    2021-01-17 10:32

    Your best bet is to construct the link manually using the UrlHelper available in the controller. Having said that, I'm suspicious that there is probably a better way to handle this in a view or partial view, shared or otherwise.

    string a = "Email is locked, click here to unlock.";
    

提交回复
热议问题