【问题标题】:how to adjust only first column width of the dynamic webgrid?如何仅调整动态 webgrid 的第一列宽度?
【发布时间】:2014-11-10 11:50:52
【问题描述】:

我有动态 webgrid,它在 ASP.NET MVC 中动态绑定来自后端的数据。 在这里,我想调整该动态 webgrid 中第一列的宽度。

<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)
}

谢谢...!!

【问题讨论】:

  • This question 可能会有所帮助
  • 谢谢你....斯蒂芬·穆克...

标签: asp.net-mvc-3 asp.net-mvc-4 webgrid


【解决方案1】:

试试这个

@Html.TextBox("PriceType"+(int)item.ShoppingCartID,(int)item.PriceType,new{@style="display:none;width:100px"})</span>),

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-28
    • 2021-12-05
    • 1970-01-01
    • 2012-10-23
    • 1970-01-01
    • 2015-01-27
    • 1970-01-01
    相关资源
    最近更新 更多