<script type="text/template" id="CustomerForm"> <b>Order Details</b> <table cellspacing="10"> . . .
<tr> <td style="text-align: right;" valign="top">Picture </td> <td style="text-align: left" valign="top"> <div id="UploadInput"></div> </td>
</tr> </table> |
<div> <ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" > <ClientSideEvents ActionComplete="complete" /> <FilterSettings FilterType="Menu" /> <Columns> <ej:Column Field="OrderID" IsPrimaryKey="True" TextAlign="Right" Width="90" /> <ej:Column Field="CustomerID" Width="100" /> <ej:Column Field="EmployeeID" TextAlign="Right" Width="100" /> </Columns> <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="InlineFormTemplate" InlineFormTemplateID="#CustomerForm"></EditSettings> </ej:Grid> function complete(args) { //render uploadbox control if ((args.requestType == "beginedit" || args.requestType == "add")) { $('#UploadInput').ejUploadbox({ saveUrl: "saveFiles.ashx", }); } |
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); string targetFolder = HttpContext.Current.Server.MapPath("") + "\\New folder\\"; if (!Directory.Exists(targetFolder)) { Directory.CreateDirectory(targetFolder); } HttpRequest request = context.Request; HttpFileCollection uploadedFiles = context.Request.Files; if (uploadedFiles != null && uploadedFiles.Count > 0) { for (int i = 0; i < uploadedFiles.Count; i++) { string fileName = uploadedFiles[i].FileName; int indx = fileName.LastIndexOf("\\"); if (indx > -1) { fileName = fileName.Substring(indx + 1); } uploadedFiles[i].SaveAs(targetFolder + "\\" + fileName); } }
|
<div> <ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" > <ClientSideEvents ActionComplete="complete" ActionBegin="begin" /> <FilterSettings FilterType="Menu" /> <Columns> <ej:Column Field="OrderID" IsPrimaryKey="True" TextAlign="Right" Width="90" /> <ej:Column Field="CustomerID" Width="100" /> <ej:Column Field="EmployeeID" TextAlign="Right" Width="100" /> </Columns> <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="InlineFormTemplate" InlineFormTemplateID="#CustomerForm"></EditSettings> </ej:Grid> <script> function complete(args) { //render uploadbox control if ((args.requestType == "beginedit" || args.requestType == "add")) { $('#UploadInput').ejUploadbox({ saveUrl: "saveFiles.ashx", showFileDetails: false, fileSelect : "select", }); } } function begin(args) { if (args.requestType == "save") { var upload = $('#UploadInput').ejUploadbox("instance"); var wrapper = upload.diaObj.wrapper; var fileItem = wrapper.find(".e-ul li.e-upload-file"); upload._xhrPerformUpload($(fileItem).data("file")); } }
function select(args) { var filename = args[0].name; $("#par").html(filename); }
|