3

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

Vishal Suthar
  • 17,013
  • 3
  • 59
  • 105
Somedeveloper
  • 817
  • 2
  • 14
  • 31

1 Answers1

26

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

markS
  • 580
  • 5
  • 14