Extending an ASP.NET Datagrid to Support Simple Cross Tab Reporting: The Structure - The properties available to customize the custom control
(Page 3 of 4 )
The following is the source code related to every property defined within the custom control. You can observe that all the properties become available under a separate category called “CrossTab Details.” I am also using the “viewstate” object to hold the property values. Let us walk through each of the properties.
<Category("CrossTab details")> _
Public Property ObjectName() As String
Get
Return viewstate("ObjectName")
End Get
Set(ByVal Value As String)
viewstate("ObjectName") = Value
End Set
End Property
The above property is mainly used to provide table name or stored procedure name.
<Category("CrossTab details")> _
Public Property TypeOfObject() As ObjectType
Get
If viewstate("TypeOfObject") Is Nothing Then
viewstate("TypeOfObject") = ObjectType.Table
End If
Return viewstate("TypeOfObject")
End Get
Set(ByVal Value As ObjectType)
viewstate("TypeOfObject") = Value
End Set
End Property
The above property is mainly used to specify whether the data source is a table or stored procedure.
<Category("CrossTab details")> _
Public Property RowFieldName() As String
Get
Return viewstate("RowFieldName")
End Get
Set(ByVal Value As String)
viewstate("RowFieldName") = Value
End Set
End Property
The above property specifies the column name which the cross-tab needs to retrieve for the first left column.
<Category("CrossTab details")> _
Public Property ColFieldName() As String
Get
Return viewstate("ColFieldName")
End Get
Set(ByVal Value As String)
viewstate("ColFieldName") = Value
End Set
End Property
The above property specifies the column name which the cross-tab needs to retrieve for the first top row.
<Category("CrossTab details")> _
Public Property SummaryFieldName() As String
Get
Return viewstate("SummaryFieldName")
End Get
Set(ByVal Value As String)
viewstate("SummaryFieldName") = Value
End Set
End Property
The above property specifies the column name which the cross-tab needs to retrieve for summarizing (or processing) data.
<Category("CrossTab details")> _
Public Property TypeOfOperation() As OperationType
Get
If viewstate("TypeOfOperation") Is Nothing Then
viewstate("TypeOfOperation") = OperationType.Sum
End If
Return viewstate("TypeOfOperation")
End Get
Set(ByVal Value As OperationType)
viewstate("TypeOfOperation") = Value
End Set
End Property
The above property specifies the type of summary that the cross-tab needs to process.
<Category("CrossTab details")> _
Public Property AdditionalBlankColumns() As Int16
Get
Return Val(viewstate("AdditionalBlankColumns") & "")
End Get
Set(ByVal Value As Int16)
viewstate("AdditionalBlankColumns") = Value
End Set
End Property
The above property may be necessary if you want a few more columns at the right most level for further calculations at the web form level.
Next: The core database routines >>
More ASP.NET Articles
More By Jagadish Chaterjee