c# – Transform bank information into Link


I'm making a site in which it brings a string from the bank, but I want this string to be informed as follows, a button will appear in its place that the user will click and this button will open the url that is the text that is in the string that in this case it is the Download Link.

                @Html.DisplayNameFor(model => model.Link)
                @Html.DisplayFor(modelItem => item.Link)

Here I bring the item string to appear on the screen, but I want it to be a button that opens the URL that is itself.


You can use the component called Html.ValueFor , it returns the value contained in the attribute called inside the href , and then style the <a> (you can use my css if you want). That is, imagining that your string is a link of the same type "www.google.com", just put it in your View replacing "Click here" with the text of your button.

<a class="button-style" href="@Html.ValueFor(m => m.Link)">Clique aqui</a>

CSS style for button:

.button-style {
    background-color: #4CAF50; /* Green */
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
Scroll to Top