This application shows how you can integrate DbNetEdit and DbNetFile to create simple document management system that creates and associates a folder using the customer code. Documents can then be uploaded into this folder to be associated with the customer. In addition DbNetFile also allows you to search through the documents including the content (subject to Indexing Server being enabled). Select a customer using DbNetEdit and the contensts of the customer's document folder will be displayed automatically using DbNetfile .
Register the component libraries <%@ Register TagPrefix="Edit" Namespace="DbNetLink.Web.UI" Assembly="DbNetLink.DbNetEdit" %>
<%@ Register TagPrefix="File" Namespace="DbNetLink.Web.UI" Assembly="DbNetLink.DbNetFile" %> Server Control <form id="Form1" name="Form1" method="post" runat="server">
<table>
<tr>
<td valign=top>
<fieldset>
<legend>Customers</legend>
<Edit:DbNetEdit
id="dbnetedit1"
Runat="server"
ConnectionString = "suite"
TableName = "customers"
PrimaryKeyName = "customerid"
SearchFields = "customerid, companyname, contactname, address, city, region, postalcode"
SearchLabels = "Id, Company, Contact, Address, City, Region, Postal Code"
SortFields = "customerid, companyname, contactname, address, city, region, postalcode"
SortLabels = "Id, Company, Contact, Address, City, Region, Postal Code"
BrowseColumns = "companyname, contactname"
BrowseTitles = "Company, Contact"
NoLoad = "true"
RowInitialisation = "customerSelected"
>
<FormTemplate>
<table>
<tr>
<td colspan="2">
<table>
<tr>
<td id="toolbar"></td>
<td id="editNavigation"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Customer Code</td>
<td><input class="dbnetedit" id="customerid"></input></td>
</tr>
<tr>
<td>Company</td>
<td><input class="dbnetedit" id="companyname"></input></td>
</tr>
<tr>
<td>Address</td>
<td><textarea class="dbnetedit" id="address"></textarea></td>
</tr>
<tr>
<td>City</td>
<td><input class="dbnetedit" id="city"></input></td>
</tr>
<tr>
<td>Region</td>
<td><input class="dbnetedit" id="region"></input></td>
</tr>
<tr>
<td>Postal Code</td>
<td><input class="dbnetedit" id="postalcode"></input></td>
</tr>
</table>
</FormTemplate>
</Edit:DbNetEdit>
</fieldset>
</td>
<td style='width:30px'> </td>
<td valign=top>
<fieldset>
<legend>Documents</legend>
<File:DbNetFile
id="dbnetfile1"
runat="server"
SmallButtons = "true"
CreateRootFolder = "true"
NoLoad = "true"
>
</File:DbNetFile>
</fieldset>
</td>
</tr>
</table>
</form>
Client-side script
window.onload = initialise
//////////////////////////////////////////////////////////////////////////////////////////////
function initialise()
//////////////////////////////////////////////////////////////////////////////////////////////
{
window.DbNetEditArray["dbnetedit1"].initialise();
}
//////////////////////////////////////////////////////////////////////////////////////////////
function customerSelected(form, rowIndex)
//////////////////////////////////////////////////////////////////////////////////////////////
{
if (form.mode != "update")
return
with ( window.DbNetFileArray["dbnetfile1"] )
{
rootFolder = '/data/customer_docs/' + form.inputControl("customerid", rowIndex).value
rootFolderAlias = form.inputControl("companyname", rowIndex).value
initialise()
}
}