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.

  1. private static void GenerateColumns(this SPGridView gridView, SPList list )
  2. {
  3. gridView.AutoGenerateColumns = false;
  4. foreach( var column in from string fieldname in list.DefaultView.ViewFields
  5. select list.Fields.GetFieldByInternalName( fieldname )
  6. into field
  7. select new BoundField
  8. {
  9. DataField = field.StaticName,
  10. HeaderText = field.Title
  11. } )
  12. {
  13. gridView.Columns.Add( column );
  14. }
  15. }
Share

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>