Search code examples
c#cssactionlink

ActionLink that acts like a text


I have an @Html.ActionLink in a webpage.

@Html.ActionLink("Hello ", "Index", "Manage", routeValues: new { Area = "" }, htmlAttributes: new { title = "Manage", @class = "user-btn clientName"})

looks like this: enter image description here

The clientName contains the name of the user. I have an ajax call that sets the clientName

 $.ajax({
            type: "GET",
            url: url,
            data: { userId: currentUserId },
            success: function (data) {
                $(".clientName").text($(".clientName").text() + data + "!");
            },
            failure: function (data) {
            }
        });

Now I need only a text instead of the ActionLink. I don't know how to use the TextAreaFor in this case. I have tried with a javascript to disable the link, it is disabled, but it is still a link. Can you please help me with a css for ActionLink to be like a text, or with a solution to write that clientName in a text. Thanks


Solution

  • If you wants behave that test as link, and only wants to remove the under line and hand symbol you can use the following CSS.

    text-decoration:none; 
    cursor:text
    

    or If you don't want the link behavior it self, you can directly use @Html.Label.