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.

Installing DbNetSuite with NuGet

After installing the DbNetSuite Nuget package follow the simple steps below to get your first DbNetSuite application up and running.

You can view online samples of DbNetSuite applications here and online help here.

Add your database connection to the web.config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  ...
  <connectionStrings>
    ...
    <add name="Northwind" connectionString="Server=DbServer;Database=Northwind;Uid=WebUser;Pwd=??????;"
	...
  </connectionStrings>
  ...
</configuration> 
	

Add Http Handler mappings to the web.config file

By default the Nuget installer will add the necessary HttpHandler mappings but if you need to add them manually then the config section in which they are added depends on whether you are using the VS development server or IIS7+/IIS Express

Http Handler mappings for Visual Studio Development server
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  ...
  <system.web>
    ...
      <httpHandlers>
        <add verb="*" path="dbnetgrid.ashx" type="DbNetLink.DbNetSuite.DbNetGrid" validate="false" />
        <add verb="*" path="dbnetedit.ashx" type="DbNetLink.DbNetSuite.DbNetEdit" validate="false" />
        <add verb="*" path="dbnetfile.ashx" type="DbNetLink.DbNetSuite.DbNetFile" validate="false" />
        <add verb="*" path="dbnetspell.ashx" type="DbNetLink.DbNetSuite.DbNetSpell" validate="false" />
        <add verb="*" path="dbnetcombo.ashx" type="DbNetLink.DbNetSuite.DbNetCombo" validate="false" />
        <add verb="*" path="dbnetlist.ashx" type="DbNetLink.DbNetSuite.DbNetList" validate="false" />
        <add verb="*" path="dbnetsuite.js.ashx" type="DbNetLink.DbNetSuite.JS" validate="false" />
        <add verb="*" path="dbnetsuite.css.ashx" type="DbNetLink.DbNetSuite.CSS" validate="false" />
      </httpHandlers>
	...
	</system.web>
  ...
</configuration> 
	
Http Handler mappings for IIS 7+/IIS Express
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  ...
	<system.webServer>
		...
		<handlers>
			<add name="dbnetgrid_ashx" verb="*" path="dbnetgrid.ashx" type="DbNetLink.DbNetSuite.DbNetGrid"/>
			<add name="dbnetedit_ashx" verb="*" path="dbnetedit.ashx" type="DbNetLink.DbNetSuite.DbNetEdit"/>
			<add name="dbnetfile_ashx" verb="*" path="dbnetfile.ashx" type="DbNetLink.DbNetSuite.DbNetFile"/>
			<add name="dbnetspell_ashx" verb="*" path="dbnetspell.ashx" type="DbNetLink.DbNetSuite.DbNetSpell"/>
			<add name="dbnetcombo_ashx" verb="*" path="dbnetcombo.ashx" type="DbNetLink.DbNetSuite.DbNetCombo"/>
			<add name="dbnetlist_ashx" verb="*" path="dbnetlist.ashx" type="DbNetLink.DbNetSuite.DbNetList"/>
			<add name="dbnetsuite_js_ashx" verb="*" path="dbnetsuite.js.ashx" type="DbNetLink.DbNetSuite.JS"/>
			<add name="dbnetsuite_css_ashx" verb="*" path="dbnetsuite.css.ashx" type="DbNetLink.DbNetSuite.CSS"/>
		</handlers>
		...
	</system.webServer>
  ...
</configuration> 
	

Update the routing table (MVC only)

If you are creating an MVC application you need to update the route table to ensure that the HTTP handlers used by DbNetSuite are not re-routed. To do this simply add the higlighted line below to the file global.asax.cs.

public static void RegisterRoutes(RouteCollection routes)
{
	routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
	routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");

	routes.MapRoute(
		"Default", // Route name
		"{controller}/{action}/{id}", // URL with parameters
		new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
	);

}
	

Update the evaluation license key

Copy and paste the value below into the DbNetSuiteLicenseKey application setting in the web.config file.
30 day evaluation license key
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  ...
  <appSettings>
    ...
        
	...
  </appSettings>
  ...
</configuration> 
	

Create your first DbNetSuite application

DbNetSuite gives you a number of implementation choices based on your development/deployment environment. See the samples below for a simple implementation of DbNetGrid in each of the supported environments.

MVC Partial View (Razor syntax)
<h3>Customers</h3>
<div id="CustomersGrid"></div>
@using DbNetLink.DbNetSuite.UI
@{
    DbNetGrid Grid = new DbNetGrid();
    Grid.ID = "CustomersGrid";
    Grid.ConnectionString = "Northwind";
    Grid.FromPart = "customers";
                                                      
    @Html.Raw(MVC.Render(Grid));
}
	
Server Control (Code-behind)
using DbNetLink.DbNetSuite.UI;

public partial class MyPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
		base.Page_Load();
        DbNetGrid CustomerGrid = new DbNetGrid();
	    CustomerGrid.ID = "CustomersGrid";
	    CustomerGrid.ConnectionString = "Northwind";
	    CustomerGrid.FromPart = "customers";

	    Page.Form.Controls.Add(CustomerGrid);
    }
}	
Server Control (Markup)
<%@ Register TagPrefix="DNL"  Namespace="DbNetLink.DbNetSuite.UI" Assembly="DbNetLink.DbNetSuite" %>
...
<form runat=server>
	...
	<h3>Customers</h3>
	<DNL:DbNetGrid 
		id="CustomersGrid" 
		runat="server" 
		ConnectionString = "Northwind"
		FromPart = "customers"
		>
	</DNL:DbNetGrid>
	...
</form>
	
Javascript object (client-side)
<link rel="stylesheet" type="text/css" href="dbnetsuite.css.ashx" />
<script language="JavaScript" src="dbnetsuite.js.ashx"></script>
...
<div id="CustomersGrid"></div>
...
<script type="text/javascript">

jQuery(document).ready( init )

function init()
{
	var customersGrid = new DbNetGrid("CustomersGrid");
	with (customersGrid)
	{
		connectionString = "Northwind"
		fromPart = "customers"
		initialize()
	}
}
</script>