Sending custom error messages from server to the c

4 posts, 0 answers
  1. Luke
    Luke avatar
    12 posts
    Member since:
    Mar 2011

    Posted 27 Apr 2011 Link to this post


    I'm currently working on uploader to sharepoint. My problem is that often when SP is down uploader still shows that everything went ok. Therefore I would like to make sure that if SP failed, (even though uploader managed to save it ok to local folder) error message is displayed. Possibly I would like to reuse uploader's error showing capabilities rather than lets say alert or error box.

    I did some research and I found one person on this forum with similar issues.

    This is my code

    // HANDLER
    public override bool SaveChunkData(string filePath, long position, byte[] buffer, int contentLength, out int savedBytes)
                bool ret = base.SaveChunkData(filePath, position, buffer, contentLength, out savedBytes);
                if (base.IsFinalFileRequest() == true)
                                // Moving file to SP
                            catch (Exception e)
                                Error = "Couldn't upload file to SP.";
                                this.AddReturnParam(RadUploadConstants.ParamNameMessage, Error);
                                this.AddReturnParam(RadUploadConstants.ParamNameSuccess, false);
                                this.AddReturnParam(RadUploadConstants.ParamNameFileName, this.GetFileName());
                                this.AddReturnParam(RadUploadConstants.ParamNameFinalFileRequest, true);
                                this.Result.Add("Error", Error);
    // CLIENT
    private void FileUploader_FileUploadFailed(object sender, FileUploadFailedEventArgs e)
                RadWindow.Alert(new DialogParameters
                        Header = "Upload failed",
                        Content = e.HandlerData.Message

    On client side e is empty with no messages at all. What am I doing wrong?
  2. Alex Fidanov
    Alex Fidanov avatar
    637 posts

    Posted 02 May 2011 Link to this post

    Hi Luke,

    Have you tried using the AddReturnFileParam method instead of AddReturnParam? Also, in your code I cannot see what value is returned from the SaveChunkData method? Are you returning true or false?

    Alex Fidanov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. MD
    MD avatar
    55 posts
    Member since:
    Jul 2012

    Posted 19 Oct 2011 Link to this post

    What would be the recommended way to return the error to the client from SaveChunkData?  If you add the below return parameters and return false from SaveChunkData the warning icon appears next to the file with issues, but the progress bar color is still green and the overall progress bar (multiple files) appears as if it is stalled under 100% and is still colored green with no indication that there was a problem.

    AddReturnFileParam(RadUploadConstants.ParamNameMessage, success.Message);
    AddReturnFileParam(RadUploadConstants.ParamNameSuccess, false);
    AddReturnFileParam(RadUploadConstants.ParamNameFinalFileRequest, true);
  4. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 24 Oct 2011 Link to this post

    Hi Md,

    The progress bar with the overall details keeps track only of those files that passed all validations and that are valid for upload - RadUpload.CurrentSession.ValidFiles collection. This is why if one file isn't valid for upload, its size won't be included in the progress bar calculations and the ProgressBar will display only the upload progress of the items in the ValidFiles collection of the session.

    Also, please keep in mind that when you validate a file in the SaveChunkData method, you have to call the base.SavaChinkData() method only after the file passes the validation. Otherwise even if the SaveChunkData method returns false, once its base method is called for the invalid file, the file will be uploaded.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top