This is a migrated thread and some comments may be shown as answers.

StartUpload won't fire after a DomainContext.SubmitChanges

1 Answer 72 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Matt Brewington
Top achievements
Rank 1
Matt Brewington asked on 14 Sep 2010, 03:21 PM
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

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 17 Sep 2010, 06:14 PM
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
Tags
Upload
Asked by
Matt Brewington
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or