MVC WebGrid Set the ID rendered

10,808

when you're rendering your table is when you give it the id. @someGrid.GetHtml(htmlAttributes: new {id ="someIDWhichIset"}, columns: ....

Share:
10,808
Somedeveloper
Author by

Somedeveloper

Updated on June 05, 2022

Comments

  • Somedeveloper
    Somedeveloper about 2 years

    Using WebGrid from MVC 3 how do i specify the name of the control when rendered i.e. the id of the table when rendered??

    var someGrid = new WebGrid(source: Model.Users, defaultSort: "Name", rowsPerPage: 50);
    

    At the moment when rendered as a table it is displaying as

    <table class="grid">
    

    with no id set, i want to access this table using jQuery id selector but cant. Any help appreciated.

    What i want is <table id="someIDWhichIset">

    Thanks Niall