Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: jQuery MVC3
I have changed my application to incorporate a frontend changes. I have now created HTML tables, and within these tables, i have @RenderBody()
 
When my webgrid shows upon my screen, the entire screen becomes clickable instead of just the individual rows within the WEBGRID.
 
Here is Code for the WEBGRID and for the jquery that makes it clickable:
 

@{ 
    var grid = new WebGrid(Model, 
                           rowsPerPage: 5, 
                           defaultSort: "projectStatus"); 
} 
 
@using (Html.BeginForm()) 
{ 
    if (ViewBag.userTypeID == null) 
    { 
        <br /> 
        <p> @Html.ActionLink("Log On", "LogOn", "Account") to GrepTech or @Html.ActionLink("Register", "Register", "Account") if you don't have an account. 
        </p> 
    } 
         
<fieldset> 
  <legend>List Of All Projects</legend> 
  <br /> 
<div id="grid"> 
 
    @grid.GetHtml(columns: grid.Columns( 
                    grid.Column("projectCode", "Project Code", canSort: true), 
                    grid.Column("projectName", "Project Name", canSort: true), 
                    grid.Column("projectStatus", "Project Status", canSort: true), 
                    grid.Column("daysLeft", "Days Remaining", canSort: true)), 
        tableStyle: "webgrid", 
        headerStyle: "webgrid-header", 
        footerStyle: "webgrid-footer", 
        selectedRowStyle: "webgrid-selected-row", 
        rowStyle: "webgrid-row-style") 
</div> 
 
<script type="text/javascript"> 
    $(function () { 
        $('tbody tr').on('hover', function () { 
            $(this).toggleClass('clickable'); 
        }).on('click', function () { 
            var self = this; 
            $.ajax( 
                        { 
                            type: "POST", 
                            url: "/Projects/AllProjectsHeaderSR", 
                            data: "projectCode=" + $(this).find('td:first').text(), 
                            success: function (data) { 
                                $('#container').html(data); 
                                $(self).unbind('click'); 
                            } 
                        }); 
        }); 
    }); 
</script> 
</fieldset>
Posted 17-Aug-12 3:08am
Edited 17-Aug-12 12:13pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Changed :

$('tbody tr').on('hover', function () {

TO:
 $('#grid tbody tr').on('hover', function () {
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 381
1 Praneet Nadkar 237
2 Marcin Kozub 225
3 Sergey Alexandrovich Kryukov 195
4 Shweta N Mishra 161
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,327
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,920


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 17 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100