Hi
Dikshit,
Thanks
for your interest in Syncfusion products.
We
have analyzed your requirement and it can be achieved by iterating each column
and we can set the width for each column dynamically. Please refer the below
code snippet.
[CSHTML]
.Column(cols
=>
{
if ((HttpContext.Current.Session["datasource"]
as DataTable) != null)
{
System.Data.DataTable dataTable = (HttpContext.Current.Session["datasource"]
as DataTable);
foreach (System.Data.DataColumn col
in dataTable.Columns)
{
cols.Add(col.ColumnName).HeaderText(col.Caption).Width(200);
}
}
})
For
your convenience we have prepared a simple sample based on the code snippet you
have provided and the same can be downloaded from the link below.
Please
use the sample and get back to us if you have any other queries.
Please
let us know if you need any further assistance.
Regards,
Abdul
Matin M
Attachment:
SetWidthSample_c87dd3cb.zip