forked from mikebrind/ClickableRows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.cshtml
27 lines (27 loc) · 848 Bytes
/
default.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@{
Page.Title = "Clickable Rows";
var db = Database.Open("Northwind");
var query = "SELECT * FROM Customers";
var data = db.Query(query);
var columns = new[]{"CustomerID", "CompanyName", "ContactName", "Address", "City", "Country", "Phone"};
var grid = new WebGrid(data, ajaxUpdateContainerId: "grid", columnNames: columns);
}
<h1>Clickable Rows</h1>
<div id="grid">
@grid.GetHtml(
tableStyle : "table",
alternatingRowStyle : "alternate",
headerStyle : "header"
)
</div>
@section script{
<script type="text/javascript">
$(function(){
$('tbody tr').live('hover', function(){
$(this).toggleClass('clickable');
}).live('click', function(){
location.href = '/Details/' + $(this).find('td:first').text();
});
});
</script>
}