Recommendation for the following use case

7 posts, 1 answers
  1. Yoram
    Yoram avatar
    5 posts
    Member since:
    Jul 2011

    Posted 20 Jun 2012 Link to this post

    I would like to get your suggestion to handle the following use case:
    1. The form is based on the ASP:Wizard for ordering map prints
    2. The user selects maps from a database, the selected maps are added to a cart stored as datatable in the session variables. The selected maps are shown in a RadGrid with the requested quantities.
    3. In the next wizard step: For those maps with more than certain copies, the user can upload overlay information to be printed on the maps. For each line in the RadGrid shown in this step an AsyncUpload control is displayed.
    4. Only after the user completes all of the required information such as delivery and payment the cart will be stored as a record in the database.

    My questions:
    1. What will be the best practice to handle the files being upload until the cart is suppose to be stored in the database?
    2. How to avoid multiple uploads for the same item? Should I worry about it?
    3. How can I clear files when the purchase was not completed? 

    Thanks,
    Yoram
  2. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 25 Jun 2012 Link to this post

    Hi Yoram,

    I will answer you in the order you asked your question.

    1. After a postback a FileUploaded event is fired for every file. You can handle the event and manipulate the file as you want.

    2. MaxFileInputsCount property get/set the number of the uploaded files. In case that you want the user to upload only one file you can set the property to 1.

    3. Yes, you can. When a file is uploaded a remove button is rendered next to the file name. With jQuery you can click on the remove button and remove the file. E.g. :
    if (some condition) {
       $(".ruRemove").click();
    }

    In case that you are facing some difficulties to implement your case, please setup a working sample project and send it for a local investigation.

    All the best,
    Peter Filipov
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yoram
    Yoram avatar
    5 posts
    Member since:
    Jul 2011

    Posted 23 Jul 2012 Link to this post

    Hi Peter,

    I do not feel you've address my problems.
    I'm aware of the FileUpload event. However, my question is as follow:
    • The user choosed a file for upload (each control at each row has max of 1)
    • The user click the next step of the wizard
    • The event FileUpload was fired, How should I store the file in the interim period until the cart is completed? Shell I let it stay in the Temporary Upload folder?
    • If the user click on the back button of the wizard and gets back to the previous grid, it showes an empty FileUpload control with no indication that he already selected a file to upload for his cart. If he selects to upload again, now I have multiple files in the Temporary folder. The later should have overwritten the privious one. From the customer expirance perspective, he thinks that the file he previous uploaded is not there anymore if he gets an empty FileUpload control.

    1. Assuming I'm handling the first event fired by the FileUploaded, If I choose to save the file in the target folder and the cart has been aborted I need a way to remove it?
    2. If the user click on the back button and returns to the grid with the UploadControl, how can I programticaly on the server side set in the FileUpload the file that was previously selected?

    Thanks,
    Yoram
  5. Answer
    Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 25 Jul 2012 Link to this post

    Hello Yoram,

    Thank you for getting back to us.

    For the specified scenario I would suggest a different approach. Instead of using an asp:Wizard control, you can use RadTabStrip and RadMultiPage. These controls can be set up to work and look like a wizard, but they also offer the ability to save the state of the controls placed inside of them, when set up properly.

    To demonstrate how you can achieve the desired functionality I've attached a small sample page with a very simple RadMultiPage control set up as a Wizard. On the first page you have a RadAsyncUpload control and a button "Next". The second page contains only 2 buttons - "Prev" and "Finish". When you select a file in the upload control and move to the next page, the file is not yet uploaded. You can event go back to the previous page and remove the selected file and add another one. This is achieved by the PostBackTriggers property of RadAsyncUpload. You can learn more about this feature in the following demo:
    http://demos.telerik.com/aspnet-ajax/upload/examples/async/persistuploadedfiles/defaultcs.aspx?product=asyncupload 

    When you click the Finish button, the file is uploaded and displayed in a RadBinaryImage.

    You can see a more detailed demo of RadTabStrip and RadMultiPage working as a Wizard in the following demo:
    http://demos.telerik.com/aspnet-ajax/tabstrip/examples/applicationscenarios/wizard/defaultcs.aspx 

    Hope this is helpful.
     
    Regards,
    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.
  6. Yoram
    Yoram avatar
    5 posts
    Member since:
    Jul 2011

    Posted 27 Aug 2012 Link to this post

    Hi Bozhidar,

    I've tried your suggestion, I'm still facing a problem.
    My AsyncUpload is part of grid itemtemplate:
    <telerik:GridTemplateColumn UniqueName="Upload" HeaderText="Upload File">
        <ItemTemplate>
            <telerik:RadAsyncUpload ID="AsyncUpload1" runat="server" AllowedFileExtensions="zip,ocd"
    MaxFileInputsCount="1" MaxFileSize="524288" PostbackTriggers="rbNext2Delivery"
    TargetFolder="~/app_Data/Uploads" OnFileUploaded="AsyncUpload1_FileUploaded">
            </telerik:RadAsyncUpload>
          </ItemTemplate>
    </telerik:GridTemplateColumn>

    The grid is dynamicaly bind to datatable which is stored as session variable (since this is the cart information)
    Protected Sub RadGrid2_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) _ 
    Handles RadGrid2.NeedDataSource
    objDT = Session("MapCart")
    RadGrid2.DataSource = objDT
    End Sub

    After I select the file to be uploaded and the AsyncUpload GUI shows it completes its loading phase, I move to the next RadPage. When I go back to the previous RadPage with the above grid. The AsyncUpload shows as empty, I would like the user to have an indication he already selected a file to be uploaded and it is pending the completing of the purchase process, or even the option to remove the file and select a different one.

    I would prefer to add the file information to the Cart Session Table and maybe to use it to fill the AsyncUpload when the user goes to the previous step.

    Any suggestions?

    BR,
    Yoram
  7. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 29 Aug 2012 Link to this post

    Hi Yoram,

    I tested the case where the AsyncUpload is nested inside the ItemTemplate of RadGrid, but it is working fine on my end. The issue must be related to your specific implementation. Could you modify the code from the example I sent you (keeping it as simple as possible) so that it resembles your implementation and reproduces the issue and paste it here, so that I can use it to test the issue locally.
     
    Regards,
    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.
  8. Yoram
    Yoram avatar
    5 posts
    Member since:
    Jul 2011

    Posted 30 Aug 2012 Link to this post

    Hi Again,

    As I was preparing the sample for you I figured out a stupid copy-paste mistake.
    At the handler of Go2Previous-RadPage I had RadGrid.ReBind() that caused the reset of the Grid and its controls.

    Thanks you for your support.
    Yoram
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017