0

I have the dynamic webgrid which binds the data from backend dynamically in ASP.NET MVC.. here i want to adjust the width of the first column in that dynamic 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)
}

thanks...!!

user2122825
  • 57
  • 1
  • 3
  • 14

1 Answers1

0

Try this

@Html.TextBox("PriceType"+(int)item.ShoppingCartID,(int)item.PriceType,new{@style="display:none;width:100px"})</span>),
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Mohit
  • 17
  • 3