3

How do I add a class to this @Html.ActionLink? I've tried many suggestion and none have worked so far.

                        @Html.ActionLink("Physician Profile",
                                     "Print",
                                     "Roster",
                                     new { profilePrintType = ProfilePrintType.PhysicianProfile},
                                     new { style="padding:2px 10px;" })

2 Answers 2

5

for reserved words you have to add @

new { @style="padding:2px 10px;", @class = "className" })
Sign up to request clarification or add additional context in comments.

1 Comment

thanks I was trying to add a new line like new { @class = "className" } and getting errors.
2
@Html.ActionLink("Physician Profile",
  "Print",
  "Roster",
  new { profilePrintType = ProfilePrintType.PhysicianProfile},
  new { style="padding:2px 10px;", @class = "some-css-class" })

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.