Log actions

5 posts, 1 answers
  1. Mazdak
    Mazdak avatar
    30 posts
    Member since:
    Nov 2010

    Posted 09 Jan 2011 Link to this post

    I want to log user actions in FileExplorer , for example there when user delete a file, I insert a log record into my database but I can not see any server side event for this. Is there any trick for doing this?


    Regards
    Mazdak
  2. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 12 Jan 2011 Link to this post

    Hi Mazdak,

    RadFileExplorer offers two server-side events - ItemCommand and ExplorerPopulated. To achieve the required functionality you can use the ItemCommand event, e.g.:
    protected void RadFileExplorer1_ItemCommand(object sender, RadFileExplorerEventArgs e)
    {
       switch (e.Command)
       {
           case "UploadFile":
               break;
           case "MoveDirectory":
               break;
           case "CreateDirectory":
               break;
           case "DeleteDirectory":
               break;
           case "DeleteFile":
               break;
           case "MoveFile":
               break;
       }
       // e.Cancel = true; // Cancel the operation
    }


    More detailed information regarding the server-side events is available in the following help article:
    Server-Side programming

    Greetings,
    Dobromir
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mazdak
    Mazdak avatar
    30 posts
    Member since:
    Nov 2010

    Posted 12 Jan 2011 Link to this post

    Hi,

    Thanks for reply, I found this out myself but as a suggestion:

    This event fires before action happen , that be nice if FileExplorer has an event which fires after action too which inform success and failiur too.

    Thanks
    Mazdak
  5. Terri-Lynn
    Terri-Lynn avatar
    45 posts
    Member since:
    Dec 2010

    Posted 01 Nov 2011 Link to this post

    I have a quick question on this one:  I have the e.Command = "UploadFile" working like a charm.  Inside this I do a... For Each uploadedFile As UploadedFile In upload.UpladedFiles.  I need to duplicate this sort of action in the e.Command = "DeleteFile".  Since a user can delete multiple files at once, I want to log who's doing that.  Help please!  :)
  6. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 04 Nov 2011 Link to this post

    Hi Terri-Lynn,

    In case of multiple file Upload / Delete the ItemCommand event is fired for each item and you can use the event argument's Path property to get the path to the file, e.g.:
    protected void rfeFiles_ItemCommand(object sender, RadFileExplorerEventArgs e)
    {
        if (e.Command == "DeleteFile")
        {
            string file = e.Path;
             
            //add logging logic
        }
    }


    Kind regards,
    Dobromir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017