Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
Grid : 0width Columns showing/Column showing with equal width
posted

Grid columns are showing first time without specified width,

Below is the code illustrated this issue,

@(Html.Infragistics().Grid<GridVM>()
.ID("myGrid")
.Width("100%")
//.Height("600px")
.AutoGenerateColumns(false)
.Columns(column =>
{

column.For(x => x.Serial).Width("0%").DataType("string");
column.For(x => x.CName).Width("27%").DataType("string");
column.For(x => x.JTitle).Width("13%").DataType("string");
column.For(x => x.CmpName).Width("21%").DataType("string");
column.For(x => x.CEmailId).Width("17%").DataType("string");
column.For(x => x.CNumber).Width("12%").DataType("string");
column.For(x => x.CNumber).Width("12%").DataType("string");

column.For(x => x.CNumber).Width("0%").DataType("string");

})
.DataSourceUrl(Url.Action("GetPartialView", "Controller", new { Id = ViewData["Id"] }))
.DataBind()
.Render()
)

If i run above code then first time when this grid rendered on client browser it is showing all columns with equal width instead columns should have same width which i've been set in Width settings. And when DataSourceUrl get data then column width is correctly adjust.

Can you please give me sample code for its resolution?

Also, i'm not sure about this BUT if height specified then its width set at first time. You can figure out this happening as well.

Thanks,

Sanjay

Parents
No Data
Reply
  • 17590
    Offline posted

    Hello Sanjay,

    Thank you for posting in our community.

    I followed the steps that you suggested and created a small sample illustrating your scenario. However I was unable to reproduced the described behavior. I set the width initially and all columns are correctly rendered. For example:

    @(Html.Infragistics().Grid(Model)

    .ID("grid1")

    .Width("100%")

    .AutoGenerateColumns(false)

    .PrimaryKey("ProductID")

    .Columns(col =>

    {

    col.For(c => c.ProductID).Width("0%").DataType("number");

    col.For(c => c.Name).Width("80%").DataType("string");

    col.For(c => c.ProductNumber).Width("30%").DataType("string");

    col.For(c => c.ReleaseDate).Width("0%").DataType("date");

    })

    .DataSourceUrl(Url.Action("GetData"))

    .Render())

    I am also attaching my sample for your reference. Please test it and let mw know what is the result on your side. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify my sample and send it back to me for further investigation.

    Please feel free to continue sending updates to this case at any time.

    igGridSetWidtInitially.zip
Children