Server API Reference

Top  Previous  Next

As an alternative to the implementation of DbNetGrid as a client-object it can also be implemented as a server-control which has the advantage of offering intellisense support in Visual Studio. The server-control acts a wrapper for the client-control and generates the required JavaScript to  implement the control.

  <%@ Register TagPrefix="DNL"  Namespace="DbNetLink.DbNetSuite.UI" Assembly="DbNetLink.DbNetSuite" %>
  ...
	<DNL:DbNetGrid 
		id="customersGrid" 
		runat="server" 
		ConnectionString = "SamplesDatabaseVistaDB"
		FromPart = "Products Join Suppliers on Products.SupplierID = Suppliers.SupplierID"
		>
		<GridColumns>
			<DNL:GridColumn ColumnExpression="Products.ProductName" Required="true"/>
			<DNL:GridColumn ColumnExpression="Suppliers.CompanyName" Required="true"/>
			<DNL:GridColumn ColumnExpression="Suppliers.Country" Required="true"/>
			<DNL:GridColumn ColumnExpression="Products.UnitPrice" Required="true" Edit="true"/>
			<DNL:GridColumn ColumnExpression="Products.SupplierID" Display="false" Required="true" Lookup="select SupplierID, CompanyName + ' (' + Country + ')' from Suppliers"/>
			<DNL:GridColumn ColumnExpression="Products.ProductID" Display="false" Edit="false" PrimaryKey="true"/>
		</GridColumns>
		<GridClientEvents>
			<DNL:GridClientEvent EventName="onRecordValidate" Handler="validateInsert"/>
		</GridClientEvents>
	</DNL:DbNetGrid>

Basic Properties

The simplest grid can be created by specifying just the ConnectionString and FromPart properties

ConnectionString

The ConnectionString property provides the information necessary to connect to the database. The connection string can either be an actual connection string or an alias which is resolved by finding a matching entry in the <connectionStrings> section of the web.config file. For details of specifying connection strings see the database connectivity section.

FromPart

The FromPart property specifies the name of the table(s) or view(s) from which the grid data should be selected. Data from multiple tables can be selected by including the join statement with the tables e.g.

<DNL:DbNetGrid 
  ID="DbNetGrid1"    
  runat="server"    
  ConnectionString="SamplesDatabase"    
  FromPart="Customers">
</DNL:DbNetGrid> 

Run Sample

GridColumns

The GridColumns collection allows you to specify the columns that you require from the table(s) and or view(s) specified in the FromPart property. See Grid Column Properties for details of grid column properties.

	<DNL:DbNetGrid 
		id="customersGrid" 
		runat="server" 
		ConnectionString = "SamplesDatabase"
		FromPart = "Suppliers"
		>
		<GridColumns>
			<DNL:GridColumn ColumnExpression="CompanyName" Label="CompanyName" Required="true"/>
			<DNL:GridColumn ColumnExpression="Address & ', ' & City as addr" Label="Address" Edit="false"/>
			<DNL:GridColumn ColumnExpression="Address" Label="Address" Display="false"/>
			<DNL:GridColumn ColumnExpression="City" Label="City" Display="false"/>
			<DNL:GridColumn ColumnExpression="Phone & '/' & Fax as phone_fax" Label="Phone/Fax" Edit="false"/>
			<DNL:GridColumn ColumnExpression="Phone" Label="Phone" Display="false"/>
			<DNL:GridColumn ColumnExpression="Fax" Label="Fax" Display="false"/>
		</GridColumns>
	

Run Sample

Additional Properties

AdvancedSearch

Enables/disables the advanced search dialog

Audit

Enables tracking of the date and the user that  changes made to the record in the edit dialog. Possible values are None, Summary and Detail. In Summary mode only the date/user of the last change to a record is recorded, in Detail mode all changes to the record are recorded and can be viewed in the Audit History dialog.

 

Auditing can also be implemented at the column level if changes to a specific column need to be tracked.

AuditDateFormat

Controls the format of the last modified date displayed when auditing is enabled.

AuditUser

Identifies the user that made a change when auditing is enabled. If the web application page is authenticated then the property will default to the authenticated user.

AutoRowSelect

Automatically selects the first row in the grid when a page is loaded (defaults to true)

Run Sample

Caption

Adds a heading row to the grid.

<DNL:DbNetGrid 
  ...
  Caption="Beverage Sales (1997)"> 
</DNL:DbNetGrid> 

Run Sample

ChartConfig

Specifies the configuration settings for a pre-configured chart to be produced from the grid data. The key properties in the object are the configuration can be generated using the Chart Configuration Dialog.

Run Sample

ChartSerialize

Hides/Shows the Serialize button in the Chart Configuration Dialog that is used for generating an object to be assigned to the ChartConfig object.

Run Sample

CommandTimeout

Specifies the number of seconds the grid population query should run before timing out. The default is 30 seconds. A value of 0 will prevent the query from timing out at all.

<DNL:DbNetGrid 
  ...
  CommandTimeout="120"> 
</DNL:DbNetGrid> 

CustomProfileProperties

User profiles can also save information other than grid properties by assigning the CustomProfileProperties property with either the name of a window property or a jQuery id or class selector that matches an input, select or textarea element as a comma separated list. The values in these elements/variables will be saved and restored with the profile.

<DNL:DbNetGrid 
  ...
  CustomProfileProperties="#reportTitle"
  UserProfile="true"
  > 
</DNL:DbNetGrid> 

Run Sample

CustomSave

Causes grid export to be send to the client for customisation first. Not suited to the export of large numbers of rows. This property is required to be set of you want to use the onCellTransform event for the export.

<DNL:DbNetGrid 
  ...
  CustomSave="true"> 
</DNL:DbNetGrid> 

Run Sample

DbNetSpell

Instance of DbNetSpell server control to be configured when adding spell checking to the edit dialog

<DNL:DbNetGrid 
	id="customersGrid" 
	runat="server" 
	ConnectionString = "SamplesDatabase"
	FromPart = "customers"
	SpellCheck="true"
	>
	<DbNetSpell
		ConnectionString="DictionaryDatabase"
		DictionaryTableName="english_us"
		>
	</DbNetSpell>
</DNL:DbNetGrid>

Run Sample

DragAndDrop

Enables/disables the re-arranging of columns using drag and drop.

EditDialogHeight

Fixes the height of the edit dialog when there are a lot of editable columns. Fields will scroll inside dialog

<DNL:DbNetGrid 
  ...
  EditDialogHeight="200px"> 
</DNL:DbNetGrid> 

Run Sample

EditLayoutColumns

Defines the number of columns over which the generated Edit dialog layout is distributed (defaults to 1)

Run Sample

EmptyOptionText

Specifies the text for the empty option in a drop down list (defaults to blank)

ExportFileName

Specifies the download file name for the exported grid

FilterColumnMode

Controls the mode in which filter columns operate. Possible values:

Simple (selected value is applied as a filter on its own and automatically clears any other column filters),
Combined (selected value is applied in combination with other selected filter column values)
Composite (similar to Combined but with filter options limited to reflect any currently applied column filters)

<DNL:DbNetGrid 
  ...
  FilterColumnMode="Composite"> 
</DNL:DbNetGrid>

Run Sample

FixedFilterSql

Specifies a filter to applied to the selected grid rows. Sql can include parameter placeholders with values supplied using the FixedFilterParams collection

	<DNL:DbNetGrid 
		id="customersGrid" 
		runat="server" 
		ConnectionString = "SamplesDatabase"
		FromPart = "Customers"
		FixedFilterSql="country = ?"
		>
		<GridColumns>
			<DNL:GridColumn ColumnExpression="CustomerID" Label="CompanyName" Required="true"/>
			<DNL:GridColumn ColumnExpression="CompanyName" Label="CompanyName" Required="true"/>
			<DNL:GridColumn ColumnExpression="ContactName"/>
			<DNL:GridColumn ColumnExpression="ContactTitle"/>
		</GridColumns>
		<FixedFilterParams>
			<DNL:Parameter Name="country" Value="USA"/>
		</FixedFilterParams>
	</DNL:DbNetGrid>

 

FixedFilterParams

Collection of Parameter elements used in combination with the FixedFilterSql parameter to supply parameter values.

Run Sample

 

FixedOrderBy

Fixes the order in which rows are displayed in the grid. Column header sorting is nested inside the FixedOrderBy property

<DNL:DbNetGrid 
  ...
  FixedOrderBy="Country,City"> 
</DNL:DbNetGrid> 

Run Sample

FrozenColumns

Freeze the first 'n' columns in the grid against which the remaining columns can be scrolled horizontally. Should be used in conjunction with the Width property which will fix the width of the area in which he remaining columns scroll.

	<DNL:DbNetGrid 
		id="customersGrid" 
		runat="server" 
		ConnectionString = "SamplesDatabase"
		FromPart = "customers"
		FrozenColumns = "300px"
		Width = "400px"
		>
	</DNL:DbNetGrid>

Run Sample

GridClientEvents

The GridClientEvents collection allows you to specify handlers for any of the client-side events that are available.

	<DNL:DbNetGrid 
		id="customersGrid" 
		runat="server" 
		ConnectionString = "SamplesDatabase"
		FromPart = "customers"
		>
		<GridClientEvents>
			<DNL:GridClientEvent EventName="onRecordDeleted" Handler="recordDeleted"/>
			<DNL:GridClientEvent EventName="onRecordInserted" Handler="recordInserted"/>
			<DNL:GridClientEvent EventName="onRecordUpdated" Handler="recordUpdated"/>
		</GridClientEvents>
	</DNL:DbNetGrid>

Run Sample

 

GroupBy

Groups the results by all the non-aggregated columns

<DNL:DbNetGrid 
  ...
  GroupBy="true"> 
</DNL:DbNetGrid> 

Run Sample

Having

Specifies the SQL having clause that can be used along with the GroupBy property

<DNL:DbNetGrid 
  ...
  GroupBy="true"
  Having="sum(amount) > 20000"> 
</DNL:DbNetGrid> 

 

Height

Fixes the height of the control

<DNL:DbNetGrid 
  ...
  Height="300"
  Width="600"> 
</DNL:DbNetGrid> 

Run Sample

LinkedControls

The LinkedControls collection specifies any child DbNetGrid or DbNetEdit controls. The LinkedControl element has 2 properties. LinkedControlID specified the ID of the child control and OneToOne which indicates if the parent child relationship is one-to-one or one-to-many.The relationship between the parent and child control is created by using the PrimaryKey of the parent grid to query the ForeignKey of the child control.

<DNL:DbNetGrid 
	id="CustomersGrid" 
	runat="server" 
	ConnectionString = "SamplesDatabase"
	FromPart = "Customers"
	PageSize = 10
	>
	<GridColumns>
		<DNL:GridColumn ColumnExpression="CustomerID" Display="false"/>
		<DNL:GridColumn ColumnExpression="CompanyName"/>
		<DNL:GridColumn ColumnExpression="Address"/>
		<DNL:GridColumn ColumnExpression="City"/>
	</GridColumns>
	<LinkedControls>
		<DNL:LinkedControl LinkedControlID="OrdersGrid" OneToOne="false"/>
	</LinkedControls>
</DNL:DbNetGrid>
...
<DNL:DbNetGrid 
	id="OrdersGrid" 
	runat="server" 
	ConnectionString = "SamplesDatabase"
	FromPart = "Orders"
	PageSize = 10
	>
	<GridColumns>
		<DNL:GridColumn ColumnExpression="CustomerID" ForeignKey="true" Display="false"/>
		<DNL:GridColumn ColumnExpression="OrderID"/>
		<DNL:GridColumn ColumnExpression="OrderDate" Format="D" ToolTip="Date ordered"/>
		<DNL:GridColumn ColumnExpression="RequiredDate" Format="d" ToolTip="Date required"/>
		<DNL:GridColumn ColumnExpression="ShippedDate" Format="MMM yyyy" ToolTip="Date shipped"/>
		<DNL:GridColumn ColumnExpression="Freight" Format="c" ToolTip="Freight charge"/>
	</GridColumns>
	<LinkedControls>
		<DNL:LinkedControl LinkedControlID="OrderLinesGrid" OneToOne="false"/>
	</LinkedControls>
</DNL:DbNetGrid>
...
<DNL:DbNetGrid 
	id="OrderLinesGrid" 
	runat="server" 
	ConnectionString = "SamplesDatabase"
	FromPart = "[Order Details]"
	PageSize = 10
	>
	<GridColumns>
		<DNL:GridColumn ColumnExpression="OrderID" ForeignKey="true"/>
		<DNL:GridColumn ColumnExpression="ProductID" Lookup="select productid, productname from products" Label="Product" ToolTip="Date ordered"/>
		<DNL:GridColumn ColumnExpression="UnitPrice" Format="c" ToolTip="Enter the net price (without tax)"/>
		<DNL:GridColumn ColumnExpression="Quantity" ToolTip="Enter quantity currently in stock"/>
		<DNL:GridColumn ColumnExpression="Discount" Format="p" ToolTip="Enter discount as a percentage"/>
	</GridColumns>
</DNL:DbNetGrid>

Run Sample

 

MailMergeDocuments

Collection allowing pre-defined Word merge documents to be specified and then selected from the toolbar when performing a MailMerge

Run Sample

 

MessageTimeout

The number of seconds a message is displayed before being cleared

 

MultiRowSelect

Adds the ability to select multiple rows.

<DNL:DbNetGrid 
  ...
  MultiRowSelect="true"
  MultiRowSelectLocation="left"> 
</DNL:DbNetGrid> 

Run Sample

MultiRowSelectLocation

Adds the ability to select multiple rows.

Run Sample

MultiValueLookupSelectStyle

Controls the style of selection for lookups where multiple values can be selected. These include Search Lookups, Bulk Insert lookup and where the editControlType is MultiValueTextBoxLookup. By default multiple values are selected by holding ctrl or shift when clicking on a value. By assigning "checkbox" to the property the selection is changed to display a checkbox so multiple values can be selected with a more intuitive standard mouse click.

Run Sample

NestedGrid

The NestedGrid property can be used to define an instance of a linked child grid that is displayed directly underneath the parent row. The relationship between the parent and child grid is created by using the PrimaryKey of the parent grid to query the ForeignKey of the child grid.

	<DNL:DbNetGrid 
		id="customersGrid" 
		runat="server" 
		ConnectionString = "SamplesDatabase"
		FromPart = "customers"
		>
		<GridColumns>
			<DNL:GridColumn ColumnExpression="CustomerID"/>
			<DNL:GridColumn ColumnExpression="CompanyName"/>
			<DNL:GridColumn ColumnExpression="Address"/>
			<DNL:GridColumn ColumnExpression="City"/>
		</GridColumns>
		<NestedGrid
			id="OrdersGrid"
			FromPart = "Orders"
			>
			<GridColumns>
				
				
				
				
				
				
				
			</GridColumns>
			<NestedGrid
				id="OrderDetailssGrid"
				FromPart = "[Order Details]"
				>
				<GridColumns>
					<DNL:GridColumn ColumnExpression="OrderID" ForeignKey="true"/>
					<DNL:GridColumn ColumnExpression="ProductID" Lookup="select productid, productname from products"/>
					<DNL:GridColumn ColumnExpression="Quantity"/>
					<DNL:GridColumn ColumnExpression="UnitPrice"/>
				</GridColumns>
			</NestedGrid>
		</NestedGrid>
	</DNL:DbNetGrid>

Run Sample

NoSort

Suppresses any sorting of the data in the grid.

 

OptimizeExportForLargeDataSet

Optimizes the grid export for very large numbers of rows (10,000+). Setting the property to true will minimise the amount of server memory used in the export process. Some grid formatting options such as sub-totalling  and group headers are suppressed when this property is set to true.

 

OptimizeForLargeDataSet

Optimizes the data selection algorithm for large datasets of several thousand records or more.

<DNL:DbNetGrid 
  ...
  OptimizeForLargeDataSet="true"> 
</DNL:DbNetGrid> 

Run Sample

 

OrderBy

Specifies an initial sequence by which the data is sorted.You can fix the top level of ordering by using the FixedOrderBy property.

<DNL:DbNetGrid 
  ...
  OrderBy="OrderDate desc"> 
</DNL:DbNetGrid> 

Run Sample

 

OutputCurrentPage

When set to true will restrict the Save function to the current page only.

<DNL:DbNetGrid 
  ...
  OutputCurrentPage="true"> 
</DNL:DbNetGrid> 

Run Sample

OutputPageSize

When set to a value greater than 0 will split the output into pages each with the size specified by the property.

Run Sample

PageSize

Specifies the number of rows to be displayed in each page of the grid

Run Sample

 

ProcedureName

The name of the stored procedure used as a data source for the grid

 

ProcedureParameters

Collection containing any required parameters of the stored procedure used as a data source for the grid

	<DNL:DbNetGrid 
		id="customersGrid" 
		runat="server" 
		ConnectionString = "SamplesDatabase"
		ProcedureName = "[Sales By Year]"
		Navigation = "false"
		RowInfo = "true"
		Caption = "Sales in March 1995"
		>
		<ProcedureParameters>
			<DNL:Parameter Name="BeginningDate" Value="1-Mar-1995"/>
			<DNL:Parameter Name="EndingDate" Value="31-Mar-1995"/>
		</ProcedureParameters>
		<GridColumns>
			<DNL:GridColumn ColumnExpression="ShippedDate" Label="Shipped" Format="D"/>
			<DNL:GridColumn ColumnExpression="OrderID" Label="Order ID"/>
			<DNL:GridColumn ColumnExpression="SubTotal" Label="Value" Format="C"/>
		</GridColumns>
	</DNL:DbNetGrid>

Run Sample

ProfileUser

Identifies the user against which User Profiles will be saved. If the web application is authenticated then the property will default to the authenticated user. If an application is using a custom authentication method then the property can be set in a manner similar to the following code.

///////////////////////////////////////////////////////////////
protected override void OnLoad(EventArgs e)
///////////////////////////////////////////////////////////////
{
	base.OnLoad(e);
    
	customersGrid.ProfileUser = Session["userid"].ToString();
}

 

SearchDialogHeight

Fixes the height of the search dialog when there are a lot of searchable columns. Fields will scroll inside dialog

<DNL:DbNetGrid 
  ...
  SearchDialogHeight="200px"> 
</DNL:DbNetGrid> 

SearchDialogMode

Specifies the default search mode. Can be set to either Simple, Standard or Advanced

Run Sample

SearchLayoutColumns

Specifies the number of columns over which the search criteria are distributed

Run Sample

SearchValuesOnly

Specifies if only the search values are selectable in the search dialog/panel

Run Sample

SearchPanelId

The SearchPanelId property allows you to specify the Id or Class Name of an HTML element to be used as the container of the search control (instead of the Search Dialog)

Run Sample

 

SelectModifier

Applies an SQL select modifier such as top or distinct to the query used to populate the grid

Run Sample

SimpleSearch

Enables/disables the simple search dialog

SpellCheck

Indicates that a spell checking should be enabled for all the text columns longer that 29 characters. To enable spell checking for particular columns use the column SpellCheck property. The DbNetSpell object can be configure via the DbNetSpell property.

Run Sample

StandardSearch

Enables/disables the standard search dialog

Theme

Specifies a styling theme that will control the appearance of the grid control

Run Sample

UpdateMode

Controls the mode in which record updates are entered and applied. When set to Page clicking the Update button will allow an entire page to be edited in a single transaction. The default value of Row means only the currently selected row is edited (via the Edit Dialog)

Run Sample

UploadDataFolder

Specifies the folder into which the source data file for the data upload is saved.

Run Sample

UploadExtFilter

Specifies the allowed file extensions for the data upload data source.

UploadDataTable

Specifies the name of the table or sheet in the data upload data source.

UserLanguage

Controls the culture and translation for the control by overriding the default of browser language

<DNL:DbNetGrid 
  ...
  UserLanguage="de-DE"> 
</DNL:DbNetGrid> 

ViewDialogHeight

Specifies the height of the View Dialog.

ViewDialogWidth

Specifies the width of the View Dialog.

ViewLayoutColumns

Specifies the number of columns used to display data in the View Dialog.

Run Sample

ViewTemplate

Specifies an HTML template that can be used to customise the layout of the View dialog. Elements in the template that are give an attribute of columnName with be automatically configured a fields to display data from columns with a corresponding name when a record is selected. The template must be defined as valid XML

Run Sample

ViewTemplatePath

Specifies the virtual path to an HTML file that can be used to customise the layout of the View dialog. Elements in the template that are give an attribute of columnName with be automatically configured a fields to display data from columns with a corresponding name when a record is selected.

Width

Fixes the width of the grid

Run Sample

Toolbar Properties

The following properties control the buttons and information displayed in the toolbar

Run Sample

ToolbarButtonStyle

Sets the the style of the toolbar button. Choose from Image, Text or ImageAndText

Run Sample

ToolbarLocation

Sets the location/visibility of the toolbar. Values are Top (toolbar displayed above grid), Bottom (toolbar displayed below grid) or Hidden (toolbar is hidden)

<DNL:DbNetGrid 
  ...
  Toolbar="hidden"> 
</DNL:DbNetGrid> 

Chart

Controls the appearance of the chart configuration dialog button in the toolbar

Run Sample

ColumnPicker

Controls the appearance of the column selection dialog button in the toolbar

<DNL:DbNetGrid 
  ...
  ColumnPicker="true"> 
<</DNL:DbNetGrid> 

Run Sample

Config

Adds access to the run-time configuration dialog to the toolbar

Run Sample

Copy

Controls the appearance of the Copy To Clipboard button in the toolbar

<DNL:DbNetGrid 
  ...
  Copy="false"> 
<</DNL:DbNetGrid> 

 

DeleteRow

Controls the appearance of the Delete record button in the toolbar

<DNL:DbNetGrid 
  ...
  Delete="false"> 
</DNL:DbNetGrid>  

 

InsertRow

Controls the appearance of the Insert new record button in the toolbar

<DNL:DbNetGrid 
  ...
  Insert="false"> 
</DNL:DbNetGrid> 

 

MailMerge

Adds the ability to perform Word mail-merges with the selected grid data. Only available in IE and where Word is installed on the client.

Run Sample

 

Navigation

Controls the appearance of the Navigation buttons in the toolbar

<DNL:DbNetGrid 
  ...
  Navigation="false"> 
</DNL:DbNetGrid> 

 

OutputPageSelect

Controls the appearance of the Output Current Page Only Export option in the toolbar

<DNL:DbNetGrid 
  ...
  OutputCurrentPageOption="true"> 
</DNL:DbNetGrid> 

 

PageInfo

Controls the appearance of the Page X of Y  information in the toolbar

<DNL:DbNetGrid 
  ...
  PageInfo="false"> 
</DNL:DbNetGrid>  

 

Print

Controls the appearance of the Print grid button in the toolbar

<DNL:DbNetGrid 
  ...
  Print="false"> 
</DNL:DbNetGrid>  

 

QuickSearch

Adds a search box to the toolbar which can be used to search against all the columns that have been flagged as eligible for SimpleSearch

<DNL:DbNetGrid 
  ...
  QuickSearch="true"> 
</DNL:DbNetGrid>  

 

Run Sample

 

RowInfo

Controls the appearance of the number of selected rows ( X Rows ) information in the toolbar

<DNL:DbNetGrid 
  ...
  RowInfo="false"> 
</DNL:DbNetGrid> 

 

Save

Controls the appearance of the grid Export button in the toolbar

<DNL:DbNetGrid 
  ...
  Export="false"> 
</DNL:DbNetGrid> 

 

Search

Controls the appearance of the Search dialog button in the toolbar

<DNL:DbNetGrid 
  ...
  Search="false"> 
</DNL:DbNetGrid>

 

Sort

Enables/disables access to the the Column Sort Selection dialog from the toolbar

Run Sample

 

UpdateRow

Controls the Update record button in the toolbar

<DNL:DbNetGrid 
  ...
  Update="false"> 
</DNL:DbNetGrid>

 

Upload

Adds the data upload button to the toolbar

Run Sample

 

UserProfile

Controls the User Profile  button in the toolbar

<DNL:DbNetGrid 
  ...
  UserProfile="true"> 
</DNL:DbNetGrid>

 

Run Sample

UserProfileSelect

Controls the appearance of the User Profile selection list in the toolbar

<DNL:DbNetGrid 
  ...
  UserProfile="true"
  UserProfileSelect="true"
  > 
</DNL:DbNetGrid>

 

Run Sample

View

Controls the View Dialog button in the toolbar

Run Sample

ViewPrint

Controls the appearance of the Print button in the View Dialog