Reputation: 149
Here i am using anchor tag for this class is not applying.And this is my code
<td> <a href="@Url.Action("ViewServiceDetails", "ServiceConsumer", new { BookingID = CAH.BookingID, @class = "btn btn-link", data_toggle = "modal", data_target = "#ViewServiceDetails" })">@CAH.BookingID</a></td>
Previously i used
<td> @Html.ActionLink((string)CAH.BookingID, "ViewServiceDetails", "ServiceConsumer", new { BookingID = CAH.BookingID }, new { @class = "btn btn-link", data_toggle = "modal", data_target = "#ViewServiceDetails" })</td>
but iam getting error for second one
Upvotes: 0
Views: 25
Reputation: 38509
You're going about this wrong. You're getting mixed up with 'normal' HTML, and helpers.
You don't pass in your @class attributes to the anonymous object passed to Url.Action
Just use normal HTML in conjunction with Url.Action
if you want:
You're going about this wrong.
You're getting mixed up with 'normal' HTML, and helpers.
You don't pass in your @class attributes to the anonymous object passed to Url.Action
Just use normal HTML in conjunction with Url.Action
if you want:
<td>
<a href="@Url.Action("ViewServiceDetails", "ServiceConsumer", new { BookingID = CAH.BookingID })"
class="btn btn-link"
data-toggle="modal"
data-target="#ViewServiceDetails">
@CAH.BookingID
</a>
</td>
You could use Html.ActionLink
as described here
@Html.ActionLink(CAH.BookingID, // <-- Text of link.
"ServiceConsumer", // <-- Controller Name.
"ViewServiceDetails", // <-- ActionMethod
new { BookingID = CAH.BookingID }, // <-- Route arguments.
new { @class="btn btn-link", data_toggle = "modal", data_target = "#ViewServiceDetails" } // <-- htmlArguments
)
Upvotes: 1