With DbNetGrid /DbNetEdit integration you have complete control over the way the edit capability is presented to the user. In this sample DbNetEdit is used to display the current record within a floating panel.
Register the component libraries <%@ Register TagPrefix="Edit" Namespace="DbNetLink.Web.UI" Assembly="DbNetLink.DbNetEdit" %>
<%@ Register TagPrefix="Grid" Namespace="DbNetLink.Web.UI" Assembly="DbNetLink.DbNetGrid" %> Server Control <form id="Form1" name="Form1" method="post" runat="server">
<Grid:DbNetGrid
id="dbnetgrid1"
runat="server"
ConnectionString = "suite"
FromPart = "customers"
PrimaryKeyColumn = "customerid"
PageSize = "10"
SelectPart = "CompanyName, ContactName, ContactTitle, Address, city, region, postalcode, phone,fax"
Headings = "Company, Contact,Job Title, Address, City, Region, Post Code, Phone, Fax"
Config = "false"
Help = "false"
Print = "false"
View = "false"
ColumnPicker = "false"
Save = "false"
Sort = "false"
Copy = "false"
OnDoubleClick = "revealPanel"
>
</Grid:DbNetGrid>
<Edit:DbNetEdit
id="dbnetedit1"
Runat="server"
ConnectionString = "suite"
RowInitialisation = "showPanel"
DbNetGridId = "dbnetgrid1"
>
<EditFieldProperties>
<Edit:FieldProperty ColumnName="country" Property="lookup" Value="select distinct country, country from customers"></Edit:FieldProperty>
</EditFieldProperties>
<FormTemplate>
<div id="editPanel" style="width:560px;border:1pt solid dimgray;background-color:gainsboro;position:absolute;visibility:hidden" onmousedown="dragStart(event)">
<table cellpadding="0" cellspacing="0" style="border:1pt solid silver;width:100%;background-color:steelblue" onmousedown="dragStart(event, 'editPanel')">
<tr>
<td style="width:100%"></td>
<td align="right">
<img src="/dbnetedit/images/close.gif" onclick="hidePanel()"></img>
</td>
</tr>
</table>
<table>
<tr>
<td valign="top">
<table>
<tr>
<td>Account</td>
<td><input id="customerid" class="dbnetedit"></input></td>
</tr>
<tr>
<td>Company</td>
<td><input id="companyname" class="dbnetedit"></input></td>
</tr>
<tr>
<td>Contact</td>
<td><input id="contactname" class="dbnetedit"></input></td>
</tr>
<tr>
<td>Phone</td>
<td><input id="phone" class="dbnetedit"></input></td>
</tr>
<tr>
<td>Fax</td>
<td><input id="fax" class="dbnetedit"></input></td>
</tr>
</table>
</td>
<td valign="top">
<table>
<tr>
<td>Address</td>
<td><textarea id="address" class="dbnetedit"></textarea></td>
</tr>
<tr>
<td>City</td>
<td><input id="city" class="dbnetedit"></input></td>
</tr>
<tr>
<td>Region</td>
<td><input id="region" class="dbnetedit"></input></td>
</tr>
<tr>
<td>Zip</td>
<td><input id="postalcode" class="dbnetedit"></input></td>
</tr>
<tr>
<td>Country</td>
<td><select id="country" class="dbnetedit"></select></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<table>
<tr>
<td id="toolbar"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" id="messageLine"></td>
</tr>
</table>
</div>
</FormTemplate>
</Edit:DbNetEdit>
</form>
Client-side script
window.onload = initialise
//////////////////////////////////////////////////////////////////////////////////////////////
function initialise()
//////////////////////////////////////////////////////////////////////////////////////////////
{
window.DbNetGridArray["dbnetgrid1"].toolbarElement("updateRow").onclick = revealPanel;
}
//////////////////////////////////////////////////////////////////////////////////////////////
function showPanel(form)
//////////////////////////////////////////////////////////////////////////////////////////////
{
if (form.mode == "insert")
revealPanel()
}
//////////////////////////////////////////////////////////////////////////////////////////////
function revealPanel()
//////////////////////////////////////////////////////////////////////////////////////////////
{
if ($("editPanel").style.visibility == "hidden")
{
with ($("editPanel"))
{
style.visibility="visible"
if (style.left == "")
{
style.left = ((screen.availWidth - offsetWidth) / 2) + "px"
style.top = ((screen.availHeight - offsetHeight) / 2) + "px"
}
}
var pageSelector = window.DbNetGridArray["dbnetgrid1"].toolbarElement( "pageNumber" )
pageSelector.style.visibility = "hidden"
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
function hidePanel()
//////////////////////////////////////////////////////////////////////////////////////////////
{
if ($("editPanel").style.visibility == "visible")
{
$("editPanel").style.visibility="hidden"
var pageSelector = window.DbNetGridArray["dbnetgrid1"].toolbarElement( "pageNumber" )
pageSelector.style.visibility = "visible"
}
}