StartUpload won't fire after a DomainContext.SubmitChanges

2 posts, 0 answers
  1. Matt Brewington
    Matt Brewington avatar
    5 posts
    Member since:
    Jun 2010

    Posted 14 Sep 2010 Link to this post

    Hello,

    After I add an entity and call Submit Changes on a domain context, the call to StartUpload on the RadUploader will not execute.
    I have pasted some example code from what I am doing below.  StartUpload is not executed and the completed event is never hit.
    Is there something I should be doing that I'm missing?  If I switch the order of things and have the radupload run before the submit changes, it works fine.  But I have to submit changes first because in my custom rad upload handler, I add the files to a database and I need the new id of the entity submitted.


    //  add new entity to domain context
    myDomainContext.MyEntitySet.Add(myNewEntity);
     
    //  call submit changes with call back method
    myDomainContext.SubmitChanges(submitOp_Completed, null);
     
    //  submit changes call back method
    void submitOp_Completed(SubmitOperation submitOp)
    {
         if (submitOp.HasError)
         {
              submitOp.MarkErrorAsHandled();
         }
          
         if (this.taskerAttachment.CurrentSession.TotalFilesCount != 0)
         {
          
             myRadUploader.AdditionalPostFields.Add("newId", myNewEntity.id.ToString());
     
             myRadUploader.UploadFinished += new EventHandler<EventArgs>(myRadUploader_UploadFinished);
              
             myRadUploader.StartUpload();
         }
    }
     
     
    //  raduploader completed method
    void myRadUploader_UploadFinished(object sender, EventArgs e)
    {
         // do stuff
    }



    I am using the Silverlight 2010.2.812.1040 release, Visual Studio 2010, .Silverlight 4, Ria Services
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 17 Sep 2010 Link to this post

    Hello Matt Brewington,

    I couldn't reproduce the issue on our side. Can you please elaborate on your scenario? When do you add new entity to the domain context and call SubmitChanges()? Also what is taskerAttachment?

    I prepared a sample project using the Northwind database, where new Customer is added to the Customer table when the Add new entity button is clicked. However, in order to start uploading using myRadUploader.StartUpload(), you will have to select files to be uploaded before hitting the Add new entity button. Give this approach a try and let me know if it works for you.

    Also, if you can modify the project to better illustrate your scenario, we will be able to provide you with a better-suited solution.

    Thank you in advance.

    Kind regards,
    Tina Stancheva
    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. DevCraft banner
Back to Top