Hello Rasheed,
Unfortunately you won't be able to do both actions with a single trip to the server. When you handle an event which doesn't reset the state of the Upload control, the data inside the upload is not available. That's why you would need two buttons - one to check the value, and one to trigger the Update/Add operation.
You can hide the first button and click it automatically when a file is uploaded, so that the user doesn't have to make an additional action. One possible solution I can think of is the following:
1. Add a Button to the Edit template and set it's style to "display:none"
2. Add a hidden field to the Edit template
3. On the client, hook on to the
OnClientFileUploaded event of the Upload and save the file name to the
HiddenField's value.
4. Inside the
OnClientFileUploaded event, get a reference to the button and call it's click method.
5. On the server
Click event of the button you can get the value of the hidden field and check wether it's already saved. If it is, you can set a Label's text (also in the Edit template) to point that the file is already used.
After that you can add the "Update/Add" button and set the Upload's
PostBackTriggers property to it's ID.
All the best,
Bozhidar
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