kamagra how much to take

Generating Columns For An SPGridView With LINQ (Extension Method)

More a small development note for myself since I generally end up using all the columns in a list when developing with SPGridView’s.

private static void GenerateColumns(this SPGridView gridView, SPList list )
gridView.AutoGenerateColumns = false;
foreach( var column in from string fieldname in list.DefaultView.ViewFields
select list.Fields.GetFieldByInternalName( fieldname )
into field
select new BoundField
DataField = field.StaticName,
HeaderText = field.Title
} )
gridView.Columns.Add( column );



Leave a Reply

Your email address will not be published. Required fields are marked *