Making a clickable table cell

@model IEnumerable<TrustTeamVersion4.Models.Domain.Home> @{ ViewData["Title"] = "Graphs"; Layout = "~/Views/Shared/_Layout.cshtml"; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <h2>Graphs</h2> <h3>@ViewBag.filter</h3> <div id="chart_div"></div> @{ List<string> impacts = (List<string>)ViewData["Impacts"]; List<string> urgenties = (List<string>)ViewData["Urgenties"]; int[,] Priorities = (int[,])ViewData["Prioriteiten"]; } <table class="table table-striped table-condensed table-bordered table-responsive"> <tr> <th>Impact</th> @{ foreach (var urg in urgenties) { <th>@urg</th> } } </tr> @{ int counter = 1; foreach (var mod in impacts) { string id1 = "toon_" + counter.ToString() + "_1"; string id2 = "toon_" + counter + "_2"; string id3 = "toon_" + counter + "_3"; string id4 = "toon_" + counter + "_4"; string id5 = "toon_" + counter + "_5"; <tr> <td>@mod</td> <td id="@id1">@Priorities[counter, 1]</td> <td id="@id2">@Priorities[counter, 2]</td> <td id="@id3">@Priorities[counter, 3]</td> <td id="@id4">@Priorities[counter, 4]</td> <td id="@id5">@Priorities[counter, 5]</td> <td>@Priorities[counter, 6]</td> </tr> counter++; } } </table> <script type="text/javascript"> $("#toon_1_1").click(function () { location.href("table"); document.location.href = "Home/table"; alert("This is how we do it!"); }); </script>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.