Obout Grid Control

by Matt 7. June 2011 15:20

I’ve been using Obout Grid for a project and I must say it’s a really great control.  One issue I encountered though was when I required the ability to have columns auto generated yet still set certain properties on columns should they be included in the grid. 

This is typically what your grid would look like if you declaratively set your columns.


  1. <obout:Grid id="grid1" runat="server">
  2.         <Columns>
  3.             <obout:Column ID="Column1" DataField="Website" HeaderText="WEBSITE" ParseHTML="true" runat="server" />
  4.         </Columns>
  5.     </obout:Grid>


No examples on the Obout site show how to do this programmatically, but by poking around the library I was able to figure it out fairly easily:


  1. Results.DataSource = Table;
  2.             Results.DataBind();
  3.             foreach (Column c in from Column c in Results.Columns where c.HeaderText == "Edit" || c.HeaderText == "View" select c)
  4.             {
  5.                 c.ParseHTML = true;
  6.                 c.Width = "75";
  7.                 c.Align = "center";
  8.             }


Categories: .NET | ASP.NET | C# | Obout Controls