AJAX enabled ASP.NET components for rapid web application development
|
||||||||||||||||
|
||||||||||||||||
<link rel="stylesheet" type="text/css" href="dbnetsuite.css.ashx" /> <script language="JavaScript" src="dbnetsuite.js.ashx"></script>
<script>
jQuery(document).ready( init )
function init()
{
var dbnetedit1 = new DbNetEdit("dbnetedit1");
with (dbnetedit1)
{
connectionString = "SamplesDatabase"
fromPart = "Documents"
setColumnExpressions("DocumentID","DocumentDescription","FilePath")
setColumnLabels("DocumentID","Description","Image")
setColumnProperty("FilePath",{uploadRootFolder:"~/samples/Files",uploadExtFilter:"png,jpg,gif"})
fixedFilterSql = "FilePath like '%.png' or FilePath like '%.jpg' or FilePath like '%.gif'";
bind("onFileUploaded", assignFileName);
initialize()
}
var dbnetedit2 = new DbNetEdit("dbnetedit2");
with (dbnetedit2)
{
connectionString = "SamplesDatabase"
fromPart = "Employees"
setColumnExpressions("EmployeeID","FirstName","LastName","Photo");
setColumnProperty("Photo",{uploadExtFilter:"png,jpg,gif",maxThumbnailHeight : 60});
setColumnProperty("EmployeeID","primaryKey", true);
initialize()
}
var dbnetedit3 = new DbNetEdit("dbnetedit3");
with (dbnetedit3)
{
connectionString = "SamplesDatabase"
fromPart = "Documents"
setColumnExpressions("DocumentID","DocumentDescription","FilePath")
setColumnLabels("DocumentID","Description","PDF")
setColumnProperty("FilePath",{uploadRootFolder:"~/samples/Files",uploadExtFilter:"pdf"})
fixedFilterSql = "FilePath like '%.pdf'";
bind("onFileUploaded", assignFileName);
initialize()
}
var dbnetedit4 = new DbNetEdit("dbnetedit4");
with (dbnetedit4)
{
connectionString = "SamplesDatabase"
fromPart = "Documents"
setColumnExpressions("DocumentID","DocumentDescription","blob")
setColumnLabels("DocumentID","Description","PDF")
bind("onFileUploaded", assignFileName);
setColumnProperty("blob","uploadExtFilter","pdf")
fixedFilterSql = "Blob is not null";
initialize()
}
}
function assignFileName(sender, args)
{
if (sender.getInputControl("DocumentDescription").val() == "")
sender.getInputControl("DocumentDescription").val(args.fileName.split(".")[0])
}
</script>
<table> <tr> <td style="vertical-align:top"> <fieldset> <legend>Storing images in the file system</legend> <div id="dbnetedit1"></div> </fieldset> </td> <td style="vertical-align:top"> <fieldset> <legend>Storing images in the database</legend> <div id="dbnetedit2"></div> </fieldset> </td> </tr> <tr> <td style="vertical-align:top"> <fieldset> <legend>Storing documents in the file system</legend> <div id="dbnetedit3"></div> </fieldset> </td> <td style="vertical-align:top"> <fieldset> <legend>Storing documents in the database</legend> <div id="dbnetedit4"></div> </fieldset> </td> </tr> </table>