Example
Source
Run as client-side object
Because DbNetGrid can intergated very easily with client-side code you can quick create custom interfaces using DHTML such as this simple tabbed search example
Register the component libraries
<%@ Register TagPrefix="DNL" Namespace="DbNetLink.Web.UI" Assembly="DbNetLink.DbNetGrid" %>
Server Control
<form id="Form1" name="Form1" method="post" runat="server"> <table cellpadding=0 cellspacing=0> <tr> <td> <table id=tabs style='width:100%' cellspacing=0 cellpadding=0></table> </td> </tr> <tr> <td> </td> </tr> <tr> <td> <DNL:DbNetGrid id="customers" runat="server" ConnectionString = "samples" FromPart = "customers" Headings = "Customer ID, Customer Name, Address, City, Region, Phone, Fax" SelectPart = "customerid, companyname, address, city, region, phone, fax" PrimaryKeyColumn = "customerid" FilterPart="companyname like 'a%'" EditRow = "false" VirtualDir=".." > </DNL:DbNetGrid> </td> </tr> </table> </form>
Client-side script
window.onload = init var selectedTab ////////////////////////////////////////////////////////////////////////////////////////////// function init() ////////////////////////////////////////////////////////////////////////////////////////////// { createTabs() } ////////////////////////////////////////////////////////////////////////////////////////////// function createTabs() ////////////////////////////////////////////////////////////////////////////////////////////// { var tabs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" var table = document.getElementById("tabs") var row = table.insertRow(-1) var cell for ( var i = 0; i < tabs.length; i++ ) { cell = row.insertCell(-1) cell.innerHTML = tabs.substr(i,1) if (i == 0) cell.className = 'selectedTab' else cell.className = 'tab' cell.onclick = dbNetLink.assignHandler("selectCustomers") cell = row.insertCell(-1) cell.innerHTML = " " cell.className = "tabSpacer" } cell = row.insertCell(-1) cell.className = "tabFill" cell.innerHTML = ' <input size=10 id=searchToken type=text></input><button id=findBtn>Find</button>' document.getElementById("findBtn").onclick = find selectedTab = row.cells[0] } ////////////////////////////////////////////////////////////////////////////////////////////// function selectCustomers(event) ////////////////////////////////////////////////////////////////////////////////////////////// { selectedTab.className = 'tab' if (event) selectedTab = event.srcElement selectedTab.className = 'selectedTab' with ( window.DbNetGridArray["customers"] ) { filterPart = "<%=DbNetLink.Web.Util.Encrypt("companyname")%> like '" + selectedTab.innerText + "%'" pageNumber = 1 loadData() } } ////////////////////////////////////////////////////////////////////////////////////////////// function find() ////////////////////////////////////////////////////////////////////////////////////////////// { var searchText = document.getElementById("searchToken").value var searchColumns = <%=DbNetLink.Web.Util.Encrypt( new string[] {"companyname","contactname","address","city","phone","fax"})%> with ( window.DbNetGridArray["customers"] ) { filterPart = '' for (var i=0;i<searchColumns.length;i++) { if (filterPart != '') filterPart += ' or ' filterPart += searchColumns[i] + " like '%" + searchText + "%'" } loadData() } }