DbNetSuite is a set of lightweight integrated AJAX enabled ASP.NET components for creating web applications that interface with the database and file systems.
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.
<?xml version="1.0" encoding="utf-8"?> <configuration> ... <connectionStrings> ... <add name="Northwind" connectionString="Server=DbServer;Database=Northwind;Uid=WebUser;Pwd=??????;" ... </connectionStrings> ... </configuration>
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
<?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>
<?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>
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 ); }
<?xml version="1.0" encoding="utf-8"?> <configuration> ... <appSettings> ...... </appSettings> ... </configuration>
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.
<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)); }
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); } }
<%@ 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>
<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>