| 1. | Copy the files DbNetLink.DbNetSuite.dll, System.Web.Extensions.dll and itextsharp.dll to the bin folder of your application. If you are using the charting functionality you also need to copy System.Web.DataVisualization.dll. |
| 2. | Add your application connection string to the web.config file
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="northwind" connectionString="Server=Server4;Database=Northwind;UID=sa;PWD=password;" providerName="SqlClient" />
</connectionStrings>
</configuration>
|
| 3. | Add the the DbNetSuite HttpHandlers to the web.config file.
For IIS5 and IIS6
<?xml version="1.0"?>
<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"/>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" type="Microsoft.Web.Script.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>
</system.web>
</configuration>
For IIS7 and above
<?xml version="1.0"?>
<configuration>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<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"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" type="Microsoft.Web.Script.Services.ScriptHandlerFactory"/>
</handlers>
</system.webServer>
</configuration>
|
Implementing DbNetSuite as a server-control
| 1. | Register the server-control tag prefix
<%@ Register TagPrefix="DNL" Namespace="DbNetLink.DbNetSuite.UI" Assembly="DbNetLink.DbNetSuite" %>
|
| 2. | Add the following lines to the <form> section of your web page
<DNL:DbNetGrid
id="customersGrid"
runat="server"
ConnectionString = "northwind"
FromPart = "customers"
>
</DNL:DbNetGrid>
or |
| 3. | Create the control dynamically in code behind.
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);
}
|
Complete code
<%@ Register TagPrefix="DNL" Namespace="DbNetLink.DbNetSuite.UI" Assembly="DbNetLink.DbNetSuite" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head/>
<body>
<form runat="server">
<DNL:DbNetGrid
id="customersGrid"
runat="server"
ConnectionString = "northwind"
FromPart = "customers"
>
</DNL:DbNetGrid>
</form>
</body>
</html>
<%@ Register TagPrefix="DNL" Namespace="DbNetLink.DbNetSuite.UI" Assembly="DbNetLink.DbNetSuite" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head/>
<body>
<form runat="server"></form>
</body>
</html>
<script runat="server">
protected void Page_Load()
{
base.Page_Load();
DbNetGrid CustomerGrid = new DbNetGrid();
CustomerGrid.ID = "customersGrid";
CustomerGrid.ConnectionString = "SamplesDatabase";
CustomerGrid.FromPart = "customers";
Page.Form.Add(CustomerGrid);
}
</script>
Implementing DbNetSuite as a client-side object
| 1. | Add the following lines to the <head> section of your web page
<link rel="stylesheet" type="text/css" href="dbnetsuite.css.ashx" />
<script language="JavaScript" src="dbnetsuite.js.ashx"></script>
|
| 2. | Define the HTML element that will act as the containing element for the component
<div id="dbnetgrid1"></div>
|
| 3. | Configure the client-side object
jQuery(document).ready( init )
function init()
{
var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
with (dbnetgrid1)
{
connectionString = "northwind"
fromPart = "customers"
initialize()
}
}
|
Complete code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<link rel="stylesheet" type="text/css" href="dbnetsuite.css.ashx" />
<script language="JavaScript" src="dbnetsuite.js.ashx"></script>
<script>
jQuery(document).ready( init )
function init()
{
var dbnetgrid1 = new DbNetGrid("dbnetgrid1");
with (dbnetgrid1)
{
connectionString = "northwind"
fromPart = "customers"
initialize()
}
}
</script>
</head>
<body>
<div id="dbnetgrid1"></div>
</body>
</html>
|