MVC WebGrid Set the ID rendered

≡放荡痞女 提交于 2019-12-07 14:49:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!