Example
Source
Run as client-side object
The "look and feel" of the grid can be easliy customised using CSS and
GridColumnProperties
which allows the appearance of indivdual cells or whole rows to be modified conditionally or unconditionally.
Register the component libraries
<%@ Register TagPrefix="DNL" Namespace="DbNetLink.Web.UI" Assembly="DbNetLink.DbNetGrid" %>
Server Control
<form id="Form1" name="Form1" method="post" runat="server"> <table> <tr> <td> <DNL:DbNetGrid id="customers" runat="server" ConnectionString = "samples" Headings = "Customer Code,Customer Name,Address,City,Region,Phone,Fax" SelectPart = "customerid,companyname,address,city,region,phone,fax" FromPart = "customers" OrderColumn = "region" OrderSequence = "desc" SaveType = "enhanced" View = true PrimaryKeyColumn = 'customerid' EditRow = false > <GridColumnProperties> <DNL:ColumnProperty ColumnName="city" Property="backgroundColor" Value="orange"></DNL:ColumnProperty> <DNL:ColumnProperty ColumnName="region" Property="backgroundColor" Value="gold" Expression="/SP/" ApplyToRow="false"></DNL:ColumnProperty> <DNL:ColumnProperty ColumnName="region" Property="backgroundColor" Value="yellow" Expression="/WY/" ApplyToRow="true"></DNL:ColumnProperty> <DNL:ColumnProperty ColumnName="region" Property="backgroundColor" Value="darkorange" Expression="/WA/" ApplyToRow="false"></DNL:ColumnProperty> </GridColumnProperties> </DNL:DbNetGrid> </td> </tr> </table> </form>
Styles
table.dbnetgrid td.headingCell { background-image:url('../images/blue_gradient.gif'); } table.dbnetgrid tr.oddRow { background-color:lightblue; }