Ejemplo n.º 1
0
 Control GetBinaryImage(String name)
 {
     return(new ASPxBinaryImage()
     {
         ID = "Editor",
         ContentBytes = LocalHelper.ReadFileAsBytes(name)
     });
 }
Ejemplo n.º 2
0
 Control GetHtmlEditor(String name)
 {
     return(new ASPxHtmlEditor()
     {
         ID = "Editor",
         Html = LocalHelper.ReadFileAsString(name)
     });
 }
Ejemplo n.º 3
0
 protected void grid_CancelRowEditing(Object sender, ASPxStartRowEditingEventArgs e)
 {
     if (IsFileUploaded)
     {
         var filepath = LocalHelper.ResolveFilePath(Filename);
         File.Delete(filepath);
         Filename = null;
     }
 }
Ejemplo n.º 4
0
 Control GetMemo(String name)
 {
     return(new ASPxMemo()
     {
         ID = "Editor",
         Height = 200,
         Width = 250,
         Text = LocalHelper.ReadFileAsString(name)
     });
 }
Ejemplo n.º 5
0
        protected void grid_RowDeleting(Object sender, ASPxDataDeletingEventArgs e)
        {
            var id       = Int32.Parse(e.Keys["ID"].ToString());
            var data     = FindData(id);
            var filepath = LocalHelper.ResolveFilePath(data.Name);

            Data.Remove(data);
            File.Delete(filepath);
            e.Cancel = true;
        }
Ejemplo n.º 6
0
 protected void upload_FileUploadComplete(Object sender, FileUploadCompleteEventArgs e)
 {
     if (IsFileUploaded)
     {
         e.ErrorText = "Unable to unload more than one file. Update or cancel previous unload operation.";
         e.IsValid   = false;
         return;
     }
     if (e.IsValid)
     {
         var name     = e.UploadedFile.FileName;
         var filepath = LocalHelper.ResolveFilePath(name);
         e.UploadedFile.SaveAs(filepath, true);
         Filename = name;
     }
 }
Ejemplo n.º 7
0
 void UpdateFile(Control editor, String name)
 {
     if (editor is ASPxHtmlEditor)
     {
         var control = editor as ASPxHtmlEditor;
         var html    = control.Html;
         LocalHelper.SaveToFile(html, name);
         return;
     }
     if (editor is ASPxMemo)
     {
         var control = editor as ASPxMemo;
         var text    = control.Text;
         LocalHelper.SaveToFile(text, name);
     }
 }
Ejemplo n.º 8
0
 protected void grid_RowInserting(Object sender, ASPxDataInsertingEventArgs e)
 {
     if (IsFileUploaded)
     {
         var data = new Data {
             ID       = GetNewID(),
             Date     = DateTime.Now,
             Name     = Filename,
             Comment  = e.NewValues["Comment"].ToString(),
             FileType = LocalHelper.GetFileType(Filename)
         };
         Data.Add(data);
         Filename = null;
         grid.CancelEdit();
     }
     e.Cancel = true;
 }