问题
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
回答1:
when you're rendering your table is when you give it the id.
@someGrid.GetHtml(htmlAttributes: new {id ="someIDWhichIset"}, columns: ....
来源:https://stackoverflow.com/questions/8989958/mvc-webgrid-set-the-id-rendered