I have a paging menu PartialView in my MVC app that looks like:
<% if (Model.TotalPages > 5)
{
int index = Model.PageIndex;
int minIndex = index - 2;
int maxIndex = index + 2;
if (index < 2)
{
minIndex = 0;
maxIndex = 4;
}
if (index > Model.TotalPages - 2)
{
minIndex = Model.TotalPages - 5;
maxIndex = Model.TotalPages;
}
for (int i = minIndex; i <= maxIndex; i++)
{ %>
<li>
<span class="<%= Html.GetClass((i==index), "selected", "notselected") %>">
<a href="<%= Url.Action("TypeNav", "Catalog", new { controller = "Catalog", action = "TypeNav", group = Model.ProductGroup, position = 0, index = i, browseSize = 6 } ) %>" class="<%= Html.GetClass((i==index), "selected", "notselected") %>">
<%= i + 1%>
</a>
</span>
</li>
<% }
}
else
{
for(int i=0; i<Model.TotalPages; i++) { %>
<li>
<span class="<%= Html.GetClass((i==Model.PageIndex), "selected", "notselected") %>">
<a href="<%= Url.Action("TypeNav", "Catalog", new { controller = "Catalog", action = "TypeNav", group = Model.ProductGroup, position = 0, index = i, browseSize = 6 } ) %> ">
<%= i+1 %>
</a>
</span>
</li>
<% }
} %>
What I cannot figure out is how to set a JQuery click event on the Anchor tags. Anchor tags do not have a NAME attribute and my (very) limited experience with JQuery is that it needs NAME attributes to work with.
Any pointers are quite welcome.
TIA