Hi I'm trying to work out if I can do the below. Any advice on this would be helpful.
The short version
Can the AsyncUpload FileUploaded event be delayed till after an insert of a new record in order to obtain the newly inserted records id?
The long version
The scenario :
I have a db table which contains appointments. An associated attachments table contains any files that are related to a particular appointment.
I'm using a bound radgrid which shows all appointments (using an entity data source with automatic inserts/updates).
I want to allow the user to create a new appointment and as part of this allow attachments to be uploaded along with the new appointment.
I insert the attachments into an attachment table and associate the attachments with the appointment by the appointment id.
The issue :
The issue is that at the point of inserting the new appointment I am also inserting my attachment files (using RadAsyncUpload1_FileUploaded). I require the appointment id at the point of inserting the attachments. The appointment id is only generated on insert of the new record.
I stepped through the code and the FileUploaded triggers before the entitydatasource insert.
So I will have to insert the attachments with no associated appointment id.
On inserting the new appointment I would then have to update the attachments table and identify these new attachments, then associate the appointment id with them. This seems very prone to potential errors. The ideal solution would be if I can perform the entitydatasource insert before the file uploaded triggers as then I should be able to obtain the new appointment id and associate the new attachments records with this correctly.
Any suggestions on how to approach this problem would be appreciated.
I can if necessary not allow uploads on the initial insert of the appointment. Then if the user has attachments to upload they must edit the appointment and upload them at that point. Uploading of the files when an appointment is edited is working correctly.
Thanks.
The short version
Can the AsyncUpload FileUploaded event be delayed till after an insert of a new record in order to obtain the newly inserted records id?
The long version
The scenario :
I have a db table which contains appointments. An associated attachments table contains any files that are related to a particular appointment.
I'm using a bound radgrid which shows all appointments (using an entity data source with automatic inserts/updates).
I want to allow the user to create a new appointment and as part of this allow attachments to be uploaded along with the new appointment.
I insert the attachments into an attachment table and associate the attachments with the appointment by the appointment id.
The issue :
The issue is that at the point of inserting the new appointment I am also inserting my attachment files (using RadAsyncUpload1_FileUploaded). I require the appointment id at the point of inserting the attachments. The appointment id is only generated on insert of the new record.
I stepped through the code and the FileUploaded triggers before the entitydatasource insert.
So I will have to insert the attachments with no associated appointment id.
On inserting the new appointment I would then have to update the attachments table and identify these new attachments, then associate the appointment id with them. This seems very prone to potential errors. The ideal solution would be if I can perform the entitydatasource insert before the file uploaded triggers as then I should be able to obtain the new appointment id and associate the new attachments records with this correctly.
Any suggestions on how to approach this problem would be appreciated.
I can if necessary not allow uploads on the initial insert of the appointment. Then if the user has attachments to upload they must edit the appointment and upload them at that point. Uploading of the files when an appointment is edited is working correctly.
Thanks.