ASP.NET Ajax components

DbNetSuite is a set of lightweight integrated AJAX enabled ASP.NET components for creating web applications that interface with the database and file systems.

Implementation

DbNetSuite has been designed with flexibility in mind so it can be implemented in HTML, ASP, ASP.NET Web Forms and MVC pages.

A simple DbNetGrid MVC implementation

For the most basic implementation of DbNetGrid simply specify the name of the view or table that will act as the data source for the control.
<h3>Customers</h3>
<div id="Grid1">/<div>
@{

    DbNetLink.DbNetSuite.UI.DbNetGrid Grid = new DbNetLink.DbNetSuite.UI.DbNetGrid();
    Grid.ConnectionString = "SamplesDatabase";
    Grid.FromPart = "customers";
    Grid.ID = "Grid1";
                                                      
    @Html.Raw(DbNetLink.DbNetSuite.UI.MVC.Script(Grid));
}

A linked DbNetGrid MVC implementation

Even a more complex implementation specifying table columns and linking multiple grids together to represent one-to-many relationships does not involve much coding.
<h5>Customers</h5>
<div id="CustomersGrid"></div>
<h5>Orders</h5>
<div id="OrdersGrid"></div>
<h5>Order Lines</h5>
<div id="OrderDetailsGrid"></div>
@{
    DbNetLink.DbNetSuite.UI.DbNetGrid OrderDetailsGrid = new DbNetLink.DbNetSuite.UI.DbNetGrid();
    OrderDetailsGrid.ID = "OrderDetailsGrid";
    OrderDetailsGrid.ConnectionString = "SamplesDatabase";
    OrderDetailsGrid.FromPart = "[order details]";
    OrderDetailsGrid.PageSize = 5;
            
    DbNetLink.DbNetSuite.UI.GridColumn C = OrderDetailsGrid.GridColumns.Add("OrderID");
    C.ForeignKey = true;
    C.Display = false;
    C = OrderDetailsGrid.GridColumns.Add("ProductID");
    C.Lookup = "select productid,productname from products";
    C = OrderDetailsGrid.GridColumns.Add("UnitPrice");
    C.Format = "c";
    OrderDetailsGrid.GridColumns.Add("Quantity");
    C = OrderDetailsGrid.GridColumns.Add("Discount");
    C.Format = "p";

    DbNetLink.DbNetSuite.UI.DbNetGrid OrdersGrid = new DbNetLink.DbNetSuite.UI.DbNetGrid();
    OrdersGrid.ID = "OrdersGrid";
    OrdersGrid.ConnectionString = "SamplesDatabase";
    OrdersGrid.FromPart = "orders";
    OrdersGrid.PageSize = 5;

    OrdersGrid.GridColumns.Add("OrderID");

    C = OrdersGrid.GridColumns.Add("CustomerID");
    C.ForeignKey = true;
    C.Display = false;

    C = OrdersGrid.GridColumns.Add("EmployeeID");
    C.Lookup = "select EmployeeID, lastname from employees";

    OrdersGrid.GridColumns.Add("OrderDate");
    OrdersGrid.GridColumns.Add("RequiredDate");
    OrdersGrid.GridColumns.Add("ShippedDate");

    OrdersGrid.LinkedControls.Add(OrderDetailsGrid);

    DbNetLink.DbNetSuite.UI.DbNetGrid CustomerGrid = new DbNetLink.DbNetSuite.UI.DbNetGrid();
    CustomerGrid.ID = "CustomersGrid";
    CustomerGrid.ConnectionString = "SamplesDatabase";
    CustomerGrid.FromPart = "customers";
    CustomerGrid.PageSize = 5;


    CustomerGrid.GridColumns.Add("CompanyName");
    CustomerGrid.GridColumns.Add("ContactName");
    CustomerGrid.GridColumns.Add("ContactTitle");
    CustomerGrid.GridColumns.Add("City");

    CustomerGrid.LinkedControls.Add(OrdersGrid);
    @Html.Raw(DbNetLink.DbNetSuite.UI.MVC.Script(CustomerGrid));
}

A simple DbNetGrid Web Form implementation

For the most basic implementation of DbNetGrid simply specify the name of the view or table that will act as the data source for the control.
<DNL:DbNetGrid 
	id="customersGrid" 
	runat="server" 
	ConnectionString = "SamplesDatabase"
	FromPart = "customers"
	>
</DNL:DbNetGrid>

A linked DbNetGrid Web Form implementation

Even a more complex implementation specifying table columns and linking multiple grids together to represent one-to-many relationships does not involve much coding.
<h3>Customers</h3>
<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>
<h3>Orders</h3>
<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>
<h3>Order Lines</h3>
<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>

A simple DbNetGrid Code Behind implementation

For the most basic implementation of DbNetGrid simply specify the name of the view or table that will act as the data source for the control.
protected void Page_Load()
{
	base.Page_Load();

	DbNetGrid CustomerGrid = new DbNetGrid();
	CustomerGrid.ID = "customersGrid";
	CustomerGrid.ConnectionString = "SamplesDatabase";
	CustomerGrid.FromPart = "customers";

	Page.Form.Controls.Add(CustomerGrid);
}

A linked DbNetGrid Code Behind implementation

Even a more complex implementation specifying table columns and linking multiple grids together to represent one-to-many relationships does not involve much coding.
protected void Page_Load(object sender, EventArgs e)
{
	base.Page_Load();

	DbNetGrid OrderDetailsGrid = new DbNetGrid();
    OrderDetailsGrid.ID = "OrderDetailsGrid";
    OrderDetailsGrid.ConnectionString = "SamplesDatabase";
    OrderDetailsGrid.FromPart = "[order details]";

    GridColumn C = OrderDetailsGrid.GridColumns.Add("OrderID");
    C.ForeignKey = true;
    C.Display = false;
    C = OrderDetailsGrid.GridColumns.Add("ProductID");
    C.Lookup = "select productid,productname from products";
    C = OrderDetailsGrid.GridColumns.Add("UnitPrice");
    C.Format = "c";
    OrderDetailsGrid.GridColumns.Add("Quantity");
    OrderDetailsGrid.GridColumns.Add("Discount");

    DbNetGrid OrdersGrid = new DbNetGrid();
    OrdersGrid.ID = "ordersGrid";
    OrdersGrid.ConnectionString = "SamplesDatabase";
    OrdersGrid.FromPart = "orders";

    OrdersGrid.GridColumns.Add("OrderID");

    C = OrdersGrid.GridColumns.Add("CustomerID");
    C.ForeignKey = true;
    C.Display = false;

    C = OrdersGrid.GridColumns.Add("EmployeeID");
    C.Lookup = "select EmployeeID, lastname from employees";

    OrdersGrid.GridColumns.Add("OrderDate");
    OrdersGrid.GridColumns.Add("RequiredDate");
    OrdersGrid.GridColumns.Add("ShippedDate");

    OrdersGrid.LinkedControls.Add(OrderDetailsGrid);

    DbNetGrid CustomerGrid = new DbNetGrid();
    CustomerGrid.ID = "CustomersGrid";
    CustomerGrid.ConnectionString = "SamplesDatabase";
    CustomerGrid.FromPart = "customers";
    CustomerGrid.PageSize = 10;


    CustomerGrid.GridColumns.Add("CompanyName");
    CustomerGrid.GridColumns.Add("ContactName");
    CustomerGrid.GridColumns.Add("ContactTitle");
    CustomerGrid.GridColumns.Add("City");

    CustomerGrid.LinkedControls.Add(OrdersGrid);

    Page.Master.FindControl("ServerControl").FindControl("CustomersPanel").Controls.Add(CustomerGrid);
    Page.Master.FindControl("ServerControl").FindControl("OrdersPanel").Controls.Add(OrdersGrid);
    Page.Master.FindControl("ServerControl").FindControl("OrderDetailsPanel").Controls.Add(OrderDetailsGrid);
}

A simple DbNetGrid client-side JavaScript implementation

For the most basic implementation of DbNetGrid simply specify the name of the view or table that will act as the data source for the control.
...
<link rel="stylesheet" type="text/css" href="dbnetsuite.css.ashx" />
<script language="JavaScript" src="dbnetsuite.js.ashx"></script>
...
...
jQuery(document).ready( init )
 
function init()
{
	var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
	with (dbnetgrid1)
	{
		connectionString = "SamplesDatabase"
		fromPart = "customers"
		initialize()
	}
}
...
...
<h3>Customers</h3>
<div id="dbnetgrid1"></div>
...

A linked DbNetGrid client-side JavaScript implementation

Even a more complex implementation specifying table columns and linking multiple grids together to represent one-to-many relationships does not involve much coding.
...
<link rel="stylesheet" type="text/css" href="dbnetsuite.css.ashx" />
<script language="JavaScript" src="dbnetsuite.js.ashx"></script>
...
...
jQuery(document).ready( init )

function init()
{
	var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
	var dbnetgrid2 = new DbNetGrid("dbnetgrid2");
	var dbnetgrid3 = new DbNetGrid("dbnetgrid3");

	with (dbnetgrid3)
	{
		connectionString = "SamplesDatabase"
		fromPart = "[order details]"
		setColumnExpressions("OrderID","ProductID","Quantity","UnitPrice");

		setColumnProperty("OrderID", "foreignKey", true);
		setColumnProperty("ProductID", "lookup", "select productid, productname from products");
	}

	with (dbnetgrid2)
	{
		connectionString = "SamplesDatabase"
		fromPart = "orders"
		setColumnExpressions("OrderID","CustomerID","EmployeeID","OrderDate","RequiredDate","ShippedDate","ShipVia","Freight");

		setColumnProperty("CustomerID", "display", false);
		setColumnProperty("CustomerID", "foreignKey", true);
		setColumnProperty("EmployeeID", "lookup", "select employeeid, lastname + ',' + firstname from employees order by lastname,firstname");
		setColumnProperty("CustomerID", "lookup", "select customerid, companyname from customers");
		setColumnProperty("ShipVia", "lookup", "select shipperid, companyname from shippers");
		addLinkedControl( dbnetgrid3 )
	}

	with (dbnetgrid1)
	{
		connectionString = "SamplesDatabase"
		fromPart = "customers"
		setColumnExpressions("CustomerID","CompanyName","Address","City");
		setColumnProperty("CustomerID", "display", false);

		addLinkedControl( dbnetgrid2 )
		initialize()
	}
}
...
...
<h3>Customers</h3>   
<div id="dbnetgrid1"></div>
<h3>Orders</h3>   
<div id="dbnetgrid2"></div>
<h3>Order Details</h3>   
<div id="dbnetgrid3"></div>
...