Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello there,

                                    In my aspx page, I have two buttons -
                                    1. Upload - (uplOfficePdf_FileUploadComplete)
                                               - call uplOfficePdf.UploadFile()
                                               - Show uploaded file name in label and
                                               - save uploaded file details in page Viewstate

                                    2. Save - (btnSave_Click)
                                               - Fetch Uploaded file detail from Viewstate and Save

                                    But when I run the app, neither label text is updated nor ViewState is maintained.

                                    Could you please guide a solution for above issue.
                                    I have attached a demo project for your ref.

                                    Thank you!

                                DevExpressUploadControlTesting.zip
                                0

                                Hello Talwar,

                                ASPxUploadControl does not refresh a page when you upload a file. The control returns a JSON string back to the client side when you upload a file using the e.CallbackData property in the ASPxUploadControl.FileUploadComplete event handler.

                                On the client side, the control raises an event with the same name, and callback data can be read using the e.callbackData property.

                                All these manipulations are not stored in ViewState.

                                If you want to change the label's Text, you should wait till the client-side event is raised, and then call the ASPxClientLabel.SetText method.

                                Thanks,
                                Vest

                                0

                                Thanks for your reply.

                                But I also need to have e.UploadedFile in event handler of Save button, that's why I was trying to save it in ViewState bag.

                                Is there any wayout to have e.UploadedFile details(FileName and FileBytes) when user clicks Save button.

                                Thank you!

                                0

                                Hi,

                                Thank you for your response. As an immediate solution, you can try to upload a file and save all required information to a Session variable. This way, you will be able to extract this information later (i.e. when you press the Save button).

                                See also: ASP.NET Upload Control (WebForms & MVC) - Upload Large Files using less RAM! (coming soon in v2011 volume 1).

                                Thanks,
                                Alex

                                0

                                Thanks Alex,

                                But we don't use session variables in my application.
                                Could you please suggest any other solution to my issue?

                                Thank you!

                                0

                                Hi,

                                I believe you can use any available temporary storage for this purpose (e.g. write a file to the Temp folder). Let me know if you find this solution appropriate.

                                Thanks,
                                Alex

                                0

                                Okay... even I was thinking to save uploaded file in temp folder for tight now.

                                Btw, is it possible in my scenerio to save e.UploadedFile in ViewState using callbacks? If yes, can you please guide me how can I acheive that.

                                Thank you!

                                0

                                Hi,

                                I am afraid it is impossible, because the ViewState is not updated during callbacks (see The Concept of Callbacks).

                                Thanks,
                                Alex

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners