<body>
<table align="center" width="100%" height="100%">
<tr>
<td align="center" id="previousPhoto">
@if (Model.HasPreviousPhoto)
{
if (Model.CurrentPhotoIndex == 0)
{
<a href="@HrefHelper.ToPhoto(Model.Title, Model.CurrentPageIndex - 1, maxPhotosOnThePage)">
<section class="navSection">
<img class="previousPhoto" src="@Url.Content("~/Content/Icons/arrows.png")" />
</section>
</a>
}
else
{
<a href="@HrefHelper.ToPhoto(Model.Title, Model.CurrentPageIndex, Model.CurrentPhotoIndex - 1)">
<section class="navSection">
<img class="previousPhoto" src="@Url.Content("~/Content/Icons/arrows.png")" />
</section>
</a>
}
}
else
{
<section class="navSection"></section>
}
</td>
<td class="photoPlaceholder" align="center">
<section class="photoSection">
<img src="@Model.CurrentPhoto.GenerateSrcHTML()" />
</section>
</td>
<td align="center" id="nextPhoto">
@if (Model.HasNextPhoto)
{
if (Model.CurrentPhotoIndex == maxPhotosOnThePage)
{
<a href="@HrefHelper.ToPhoto(Model.Title, Model.CurrentPageIndex + 1, 0)">
<section class="navSection">
<img src="@Url.Content("~/Content/Icons/arrows.png")" />
</section>
</a>
}
else
{
<a href="@HrefHelper.ToPhoto(Model.Title, Model.CurrentPageIndex, Model.CurrentPhotoIndex + 1)">
<section class="navSection">
<img src="@Url.Content("~/Content/Icons/arrows.png")" />
</section>
</a>
}
}
else
{
<section class="navSection"></section>
}
</td>
</tr>
</table>
Now I need to listen to the left/right-arrows keydown event and to fire same action as those links do. As I understand, this can't be done without JS help, right? I am pretty new to ASP.NET and especially to JS, so can someone of u just show me the best way to achieve described above?