Wednesday, December 31, 2003

Source: Jan Tielens' Bloggings

Announcing the ExtendedDataGrid: Adding essential functionality to the default Windows.Forms.DataGrid..

The default System.Windows.Forms.DataGrid provided by the .NET Framework is a little bit limited in functionality. Therefore I've spent some time during my holidays building an extension to this default grid: the ExtendedDataGrid. At this point I've released a Beta version: 0.1 including these features:

  • Image DataColumn
  • Formatted Text DataColumn
  • LinkLabel DataColumn
  • Calculated field DataColumn
  • ...

New features and probably bug fixes will come soon so if you have any comments, questions, remarks, ... please let me know. If you are intrested in the ExtendedDataGrid, you can monitor this RSS Feed of the latest news. I know all these features are available as sample, code snippet, article, ... on the web, but I just hated to implement some of them all of the time, for each project. Also, if you are planning to use this component, or if you are just intrested: let me know, your support will motivate me to make further improvements. :-)

Btw, happy new year to all of you!

[Jan Tielens' Bloggings]
1:01:04 PM    trackback []     Articulate [] 

  Wednesday, December 24, 2003

Source: WebLogs @

Okay, it's time to take the wraps off. Kathleen Dollard, simply the smartest person I know, has finished her Code Generation in Microsoft .NET book for APress.

I guarantee that this will be the hardest book you read in 2004, but also that it will be the single most important book for making you as productive as you can be as a .NET or SQL Server programmer.

You know all that boring, repetitive code you write for a typical application? Do away with it and generate it automatically, letting you focus on all the custom, interesting, fun, and ground-breaking code that goes into every application.

Disclaimer: I am the book's tech editor and was Kathleen's go-to guru for XSLT. So I'm intimately familiar with everything the book talks about--particularly as chief guinea pig, since I was the first person to do a real application using her templates and techniques--and I can heartily recommend it. Even if you use a framework or other development technologies, you'll learn a lot from her explorations of codegen in .NET.

My #1 book recommendation for 2004, even though it hasn't started yet!

[WebLogs @]
6:50:14 PM    trackback []     Articulate [] 

  Saturday, December 20, 2003

How to store multiple database tables in a DataSet
A DataSet is not equivalent to the old RecordSet. Instead, a DataSet can contain numerous tables. This code shows you how to load tables from an Access database into a DataSet object and then display these tables with DataGrid.

<%@Page Language="VB"%>
<%@Import Namespace="System.Data" %>
<%@Import Namespace="System.Data.OleDb" %>

<script language="vb" runat="server">
Sub Page_Load()

 Dim strConnect As String
 strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\edward\books2.mdb"
 Dim strSelectBooks As String
 strSelectBooks = "SELECT * FROM BookList WHERE ISBN LIKE '18610033%'"
 Dim strSelectAuthors As String
 strSelectAuthors = "SELECT * FROM BookAuthors WHERE ISBN LIKE '18610033%'"
 Dim strSelectPrices As String
 strSelectPrices = "SELECT * FROM BookPrices WHERE ISBN LIKE '18610033%'"
 Dim objDataSet As New DataSet()
 Dim objConnect As New OleDbConnection(strConnect)
 Dim objCommand As New OleDbCommand()
 objCommand.Connection = objConnect
 objCommand.CommandType = CommandType.Text
 objCommand.CommandText = strSelectBooks
 Dim objDataAdapter As New OleDbDataAdapter()
 objDataAdapter.SelectCommand = objCommand
 objDataAdapter.Fill(objDataSet, "Books")

 objCommand.CommandText = strSelectAuthors
 objDataAdapter.Fill(objDataSet, "Authors")

 objCommand.CommandText = strSelectPrices
 objDataAdapter.Fill(objDataSet, "Prices")

 Dim objRelation As DataRelation
 objRelation = New DataRelation("BookAuthors", objDataSet.Tables("Books").Columns("ISBN"), objDataSet.Tables("Authors").Columns("ISBN"))
 objRelation = New DataRelation("BookPrices",objDataSet.Tables("Books").Columns("ISBN"),objDataSet.Tables("Prices").Columns("ISBN"))

 dgrTables.DataSource = objDataSet.Tables
 dgrRelations.DataSource = objDataSet.Relations
 Dim objDataView As New DataView()
 objDataView = objDataSet.Tables("Books").DefaultView

 dgrBooksData.DataSource = objDataView
 objDataView = objDataSet.Tables("Authors").DefaultView

 dgrAuthorsData.DataSource = objDataView

 objDataView = objDataSet.Tables("Prices").DefaultView
 dgrPricesData.DataSource = objDataView
End Sub


<b>DataSet.Tables Collection</b>
<asp:datagrid id="dgrTables" runat="server" /><br />
<b>DataSet.Relations Collection</b>
<asp:datagrid id="dgrRelations" runat="server" /><br />
<b>Contents of DataSet.Tables("Books")</b>
<asp:datagrid id="dgrBooksData" runat="server" /><br />
<b>Contents of DataSet.Tables("Authors")</b>
<asp:datagrid id="dgrAuthorsData" runat="server" /><br />
<b>Contents of DataSet.Tables("Prices")</b>
<asp:datagrid id="dgrPricesData" runat="server" />


11:06:05 AM    trackback []     Articulate [] 

  Friday, December 05, 2003

[Macro error: Can't compile this script because of a syntax error.] [Macro error: Can't compile this script because of a syntax error.] [Macro error: Can't compile this script because of a syntax error.] [Macro error: Can't compile this script because of a syntax error.] [Macro error: Can't compile this script because of a syntax error.]

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="SelectingInGrid.aspx.vb" Inherits="DataGridComboBox.SelectingInGrid"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
  <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
  <meta name="vs_defaultClientScript" content="JavaScript">
  <meta name="vs_targetSchema" content="">
 <body MS_POSITIONING="GridLayout">
  <form id="Form1" method="post" runat="server">
   <asp:DataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 66px" runat="server" Width="494px" Height="133px" BorderStyle="None" BorderWidth="1px" BorderColor="#CC9966" BackColor="White" CellPadding="4" AutoGenerateColumns="False">
    <FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
    <HeaderStyle Font-Bold="True" ForeColor="#FFFFCC" BackColor="#990000"></HeaderStyle>
    <PagerStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle>
    <SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
    <ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
     <asp:ButtonColumn Text="Select" CommandName="Select"></asp:ButtonColumn>
     <asp:BoundColumn DataField="firstname" HeaderText="First Name"></asp:BoundColumn>
     <asp:BoundColumn DataField="lastname" HeaderText="Last Name"></asp:BoundColumn>
     <asp:BoundColumn DataField="city" HeaderText="City"></asp:BoundColumn>
     <asp:ButtonColumn Text="Select" CommandName="Select"></asp:ButtonColumn>
   <asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 136px; POSITION: absolute; TOP: 13px" runat="server"
    Width="261px" Height="19px"></asp:Label>
   <asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 139px; POSITION: absolute; TOP: 36px" runat="server"
    Width="257px" Height="19px"></asp:Label>

8:11:39 PM    trackback []     Articulate [] 

  Tuesday, December 02, 2003


Blast From The Past

I've been blogging here for almost a year now. What a difference a year makes. I was going through some of my old blog posts, looking for some good nuggets of information that I might have forgotten about. These tips have helped me immensely, and I hope they help out some of you guys too.

posted @ 12/2/2003 9:59 AM by Robert McLaws

12:46:56 PM    trackback []     Articulate [] 

  Monday, December 01, 2003

Add a scrolling feature to a datagrid?

You can wrap it within a DIV html tag.

<DIV id="grid" style="BORDER-RIGHT:  1px solid; BORDER-TOP:  1px solid;
Z-INDEX:  131; LEFT:  13px; OVERFLOW:  scroll; BORDER-LEFT:  1px solid;
WIDTH:  750px; BORDER-BOTTOM:  1px solid; POSITION:  absolute; TOP:  160px;
HEIGHT:  210px" ms_positioning="GridLayout">

8:35:08 PM    trackback []     Articulate [] 

  Friday, November 28, 2003

Re: DG Hyperlink Column Cell Value as Query Param
Posted: 19 Nov 2003 12:12 PM
Your sql statement should be
Dim strSQL As String = "SELECT * FROM EquipmentBusReport WHERE ReceptacleID ='" & ReceptacleID & "'"

2:30:46 PM    trackback []     Articulate []