Reputation: 1071
So how can I Highlight when the client clicks Ajax.ActionLink I have a class in CSS that works with @Html.ActionLink but for
@Ajax.ActionLink("select", "Index", "Certificacion",
new { id = item.CertificacionId },
new AjaxOptions
{
HttpMethod = "GET",
UpdateTargetId = "linkEdit",
InsertionMode = InsertionMode.Replace
},
new { @class = "selectedRow" })|
so how can make that the client know was the selected
Upvotes: 1
Views: 2935
Reputation:
This could be done with JavaScript. Here's an example using jQuery:
@Ajax.ActionLink("select", "Index", "Certificacion",
new { id = item.CertificacionId },
new AjaxOptions
{
HttpMethod = "GET",
UpdateTargetId = "linkEdit",
InsertionMode = InsertionMode.Replace
},
new { @class = "selectedRow", id = "YourActionLink" })
@* Notice the added html attribute property *@
Then your jQuery code could be like this:
$(document).ready(function() {
$('#YourActionLink').click(function()
{
$(this).addClass('YourSelectedItemClass');
});
});
And then just some extremely simplified CSS just to complete this example:
.YourSelectedItemClass
{
background-color: yellow;
}
Please see this working jQuery jsFiddle to prove that the jQuery is correct.
Upvotes: 3