Example
Source
Run as client-side object
DbNetEdit
can also be added to a web page as a server-control.
Categories
Id
Name
Description
Register the component libraries
<%@ Register TagPrefix="DNL" Namespace="DbNetLink.Web.UI" Assembly="DbNetLink.DbNetEdit" %>
Server Control
<form id="Form1" name="Form1" method="post" runat="server"> <table> <tr> <td> <DNL:DbNetEdit id="categories" Runat="server" ConnectionString = "samples" TableName = "categories" BrowseColumns = "categoryname" BrowseTitles = "Category" PrimaryKeyName = "categoryid" OnEditError = "customEditErrorMessage" OnDeleteError = "customEditErrorMessage" > <FormTemplate> <fieldset> <legend>Categories</legend> <table cellspacing="5"> <tr> <td colspan="2"> <table> <tr> <td id="editNavigation"></td> <td id="toolbar"></td> </tr> </table> </td> </tr> <tr> <td>Id</td> <td><input id="categoryid" class="dbnetedit"/></td> </tr> <tr> <td>Name</td> <td><input id="categoryname" class="dbnetedit"/></td> </tr> <tr> <td>Description</td> <td><textarea id="description" class="dbnetedit"></textarea></td> </tr> <tr> <td id="navigatorStatus" colspan="2"></td> </tr> <tr> <td colspan="2" id="messageLine"></td> </tr> </table> </fieldset> </FormTemplate> </DNL:DbNetEdit> </td> </tr> </table> </form>
Client-side script
////////////////////////////////////////////////////////////////////////////////////////////// function customEditErrorMessage(form) ////////////////////////////////////////////////////////////////////////////////////////////// { var serverMessage = ['operation must use an updateable query', 'database or object is read-only', 'could not delete from specified tables'] for (var i = 0; i<serverMessage.length; i++) { if (form.msg.toLowerCase().indexOf(serverMessage[i])) { var msg = 'Database table is read-only, this is usually related to the\n' + 'permissions on the file nwind.mdb in the samples folder.\n\n' + 'To correct this problem:\n\n' + '\t1. Select the file using Windows Explorer\n' + '\t2. Right-click on the file and select Properties\n' + '\t3. Select the Security tab\n' + '\t4. Assign "Full Control" to "Everyone" and click "OK"\n\n' + 'If the problem persists then contact support@dbnetedit.com' alert(msg) form.msg = 'Database customer.mdb is read-only' break } } }