|
DbNetEdit |
Top Previous Next |
|
DbNetEdit is a database aware form control that is designed to create a browser based interface for editing database information stored in a table. It can be implemented as either a client-side object or a server-control.
Example client-side implementation code
<script>
jQuery(document).ready( init )
function init()
{
var dbnetedit1 = new DbNetEdit("dbnetedit1");
with (dbnetedit1)
{
connectionString = "SamplesDatabase"
fromPart = "employees"
setColumnExpressions("EmployeeID","FirstName","LastName","HireDate")
setColumnProperty("HireDate","readOnly",true);
bind("onRecordValidate", setHireDate)
initialize()
}
}
///////////////////////////////////////////////////////////////
function setHireDate(sender, args)
///////////////////////////////////////////////////////////////
{
if ( sender.mode == "update")
return;
args.parameters["hiredate"] = new Date();
}
</script>
Example server-side implementation code <DNL:DbNetEdit id="dbnetedit1" runat="server" ConnectionString = "SamplesDatabase" FromPart = "Employees" > <EditColumns> <DNL:EditColumn ColumnExpression="EmployeeID"/> <DNL:EditColumn ColumnExpression="FirstName"/> <DNL:EditColumn ColumnExpression="LastName"/> <DNL:EditColumn ColumnExpression="HireDate" ReadOnly="true"/> </EditColumns> <EditClientEvents> <DNL:EditClientEvent EventName="onRecordValidate" Handler="setHireDate"/> </EditClientEvents> </DNL:DbNetEdit> ...
<script>
///////////////////////////////////////////////////////////////
function setHireDate(sender, args)
///////////////////////////////////////////////////////////////
{
if ( sender.mode == "update")
return;
args.parameters["hiredate"] = new Date();
}
</script>
|