Login    
 
 
 
 
Text/HTML
  
You are here :: Blogs Saturday, May 19, 2012

Search
Note: This uses the internal blog search engine. The Google search engine is also available at the top of the page.
  
Disclaimer

Please review the site disclaimer before downloading or using content found on this site

  
Categories
  
DEVSHED Blog
As always, I welcome your comments!
Mar 10

Written by: Steve Gray
3/10/2011 6:04 PM  RssIcon

Following is an example of the ComponentArt basic grid.

Now, if you use the CA grid at all you know that they install examples right on your machine for you to learn from.

The reason that I’m coding these examples is:

  • Their examples are sometimes too verbose
  • Their examples aren’t coded the way that I have the grids coded – I use a class that abstracts a lot of the grid setup so that I don’t have to look at it, and so that it is consistent across a project.

These examples are coded in a master page, I’m providing only the needed details here.

So, here is a complete working example of the grid.

An on-line example is provided here: http://componentart.devshed.us/Examples/Grid/Basic.aspx

There is a reference to the ComponentArtGrid class in the code behind, that’s here: http://devshed.us/Blogs/tabid/227/EntryId/1004/ComponentArt-Grid-Class.aspx

And the style sheet is here (gridStyle.css) http://devshed.us/Blogs/tabid/227/EntryId/1005/ComponentArt-Grid-Css.aspx

The aspx page:

Code Snippet
  1. <%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Basic.aspx.vb" Inherits="ComponentArt.Basic" %>
  2. <%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
  3. <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
  4. </asp:Content>
  5. <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  6.     <div >
  7.         <span>This grid the basic grid</span><br />
  8.         <a href="http://devshed.us/Blogs/tabid/227/EntryId/1006/ComponentArt-Grid-Editing-ndash-Client-Mode-Example.aspx" target="_blank">The code for this example is here</a><br />
  9.  
  10.         <br />
  11.         <br />
  12.         <ComponentArt:DataGrid ID="Grid1"
  13.             runat="server">
  14.             <Levels>
  15.                 <ComponentArt:GridLevel
  16.                     DataKeyField="lRowID"
  17.                     EditCommandClientTemplateId="EditCommandTemplate"
  18.                     InsertCommandClientTemplateId="InsertCommandTemplate"
  19.                     >
  20.                     <Columns>
  21.                         <ComponentArt:GridColumn AllowEditing="false" DataField="lRowID" Visible="false" />
  22.                         <ComponentArt:GridColumn DataField="Itemnmbr" HeadingText="Item"  AllowEditing="false" />
  23.                         <ComponentArt:GridColumn DataField="Quantity" HeadingText="Quantity" />
  24.                         <ComponentArt:GridColumn DataField="UnitCost" HeadingText="Unit Cost" AllowEditing="false" />
  25.                     </Columns>
  26.                 </ComponentArt:GridLevel>
  27.             </Levels>
  28.         </ComponentArt:DataGrid>
  29.  
  30. </asp:Content>

The Code Behind:

Code Snippet
  1. Public Class Basic
  2.     Inherits System.Web.UI.Page
  3.  
  4.     Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  5.         If Not IsPostBack Then
  6.             buildGrid()
  7.             Grid1.DataBind()
  8.         End If
  9.  
  10.     End Sub
  11.  
  12.     Private Sub buildGrid()
  13.         Dim grd As New ComponentArtGrid
  14.         Grid1 = grd.setup(Me.Grid1)
  15.         Grid1.Width = 500
  16.  
  17.         Dim i As New Item
  18.         'returns a datatable of items
  19.         Grid1.DataSource = i.getItems
  20.  
  21.     End Sub
  22.  
  23. End Class

Tags:
Categories:
As always, I welcome your comments!
  
 
 
Home | Products | Blogs | Contact Us | Links | God's Plan
Privacy Statement | Terms Of Use
 
Copyright 2011 by Devshed.us