我有动态webgrid,它在ASP.NET MVC中动态地绑定来自后端的数据。 在这里,我想调整动态网页中第一列的宽度。
<style>
.webgrid-header a {
color: white !important;
}
.webgrid-header th {
text-align: center;
}
</style>
@{
var result = new List<dynamic>();
foreach (var emprow in Model)
{
var row = (IDictionary<string, object>)new ExpandoObject();
var eachEmpRow = (Dictionary<string, object>)emprow;
foreach (KeyValuePair<string, object> keyValuePair in eachEmpRow)
{
row.Add(keyValuePair);
}
result.Add(row);
}
var grid = new WebGrid(result, rowsPerPage: 50);
}
@if (@Model != null)
{
@grid.GetHtml(
htmlAttributes: new { id = "grdHoteling" },
tableStyle: "webgrid-table",
headerStyle: "webgrid-header",
footerStyle: "webgrid-footer",
alternatingRowStyle: "webgrid-alternating-row",
selectedRowStyle: "webgrid-selected-row",
rowStyle: "webgrid-row-style",
mode: WebGridPagerModes.All)
}
感谢... !!
答案 0 :(得分:0)
试试这个
@Html.TextBox("PriceType"+(int)item.ShoppingCartID,(int)item.PriceType,new{@style="display:none;width:100px"})</span>),