无法使用MVC4突出显示gridview中的行,下面是我的代码

时间:2016-03-04 20:18:19

标签: jquery asp.net-mvc-4 gridview

以下是我的观看代码

<div id="gridContent" / >
    @gd.GetHtml(
        tableStyle: "gridAlternateRowA", 
        rowStyle: "gridrow",
        headerStyle: "head",
        alternatingRowStyle: "altRow",
        selectedRowStyle: "select",
        htmlAttributes: new { id="MainTable" },
        columns: gd.Columns(
            gd.Column("","",@<a href= '@Url.Action("edit", "Rig",  new { id = item.RigCode })' ><img src="~/Content/Images/edit.PNG" alt="Details" /></a> ,style:"col1"),
            gd.Column("","",@<a href= '@Url.Action("delete", "Rig",  new { id = item.RigCode })' ><img src="~/Content/Images/delete.PNG" alt="Details" /></a> ,style:"col1"),
            gd.Column("username", " username", style: "description"),
            gd.Column("address", "address", style: "description"),
            gd.Column("CreatedBy", "CreatedBy", style: "description"),
            gd.Column("CreatedOn", "CreatedOn",  style: "description"),
            gd.Column("LastUpdatedBy", "LastUpdatedBy", style: "description"),
            gd.Column("LastUpdatedOn", "LastUpdatedOn", style: "description")
     ))
</div>

<script type="text/javascript">
    $(function () {
        var tr = $('#MainTable').find('tr');
        tr.bind('click', function (event) {
            var obj = event.target;
            if (obj.nodeName == "TH" || obj.nodeName == "A") { return; }
            $('.clickable').removeClass('select');
            var tds = $(this).find('td');
            $(this).addClass('select');
        });
    });
</script>

0 个答案:

没有答案