MVC的WebGrid将呈现的ID [英] MVC WebGrid Set the ID rendered

查看:108
本文介绍了MVC的WebGrid将呈现的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从MVC 3使用的WebGrid的呈现方式时,即当呈现??表的id做我指定控件的名称

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">

未设置ID,我想使用jQuery id选择,但不能访问此表。任何帮助AP preciated。

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

我要的是&LT;表ID =someIDWhichIset&GT;

谢谢
尼尔·

推荐答案

当你渲染你的表是当你给它的ID。
@ someGrid.GetHtml(htmlAttributes:新{ID =someIDWhichIset},列:....

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

这篇关于MVC的WebGrid将呈现的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆