In this tutorial, you will learn how to use the UnboundColumnFetch event to display two fields (First and Last) together in one column.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim dtCopy As New DataTable() |
To write code in C#
C# |
Copy Code
|
---|---|
DataTable dtCopy = new DataTable(); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Visual Studio 2005 adds this line of code to load the data. Me.ComposerTableAdapater.Fill(Me.DsComposer.Composer) dtCopy = Me.DsComposer1.Tables(0).Copy() Me.C1List1.Splits(0).DisplayColumns.Item ("Last").Visible = False Me.C1List1.Splits(0).DisplayColumns.Item ("First").Visible = False |
To write code in C#
C# |
Copy Code
|
---|---|
// Visual Studio 2005 adds this line of code to load the data. this.ComposerTableAdapter.Fill(this.DsComposer.Composer); dtCopy = this.DsComposer1.Tables[0].Copy(); this.c1List1.Splits[0].DisplayColumns["Last"].Visible = false; this.c1List1.Splits[0].DisplayColumns["First"].Visible = false; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub C1List1_UnboundColumnFetch(ByVal sender As Object, ByVal e As C1.Win.C1List.UnboundColumnFetchEventArgs) Handles C1List1.UnboundColumnFetch If (e.Col = 0 And e.Row < dtCopy.Rows.Count) Then e.Value = dtCopy.Rows(e.Row).Item("First") + " " + dtCopy.Rows(e.Row).Item("Last")" End If End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void C1List1_UnboundColumnFetch( object sender, C1.Win.C1List.UnboundColumnFetchEventArgs e) { if (e.Col == 0 && e.Row < dtCopy.Rows.Count) { e.Value = dtCopy.Rows[e.Row].["First"] + " " + dtCopy.Rows[e.Row].["Last"]"; } } |
This concludes the tutorial.