is it possible to maintain the state of RadAsyncUpload Control after postback ?

14 posts, 0 answers
  1. Rasheed
    Rasheed avatar
    32 posts
    Member since:
    Jan 2012

    Posted 25 Jan 2012 Link to this post

    hi 
    i have RadGrid Control, popup edit template form which includes two AsyncUpload controls, a user will use those AsyncUpload controls to upload two files then a submit button will be clicked by the user to insert and submit the data, in code behind i'm checking if the file exists and if it does i'm keeping the popup template opened and show a RadAlert message tells the user that his file already existed, but the AsyncUpload controls are going back to thier default state where no file is selected, maybe i'm silly to look for this scenario but i don't want the user to get bored where he is going to reselect his files again, is there any possible way to maintain the AsyncUpload state ?

    thank you 
  2. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 26 Jan 2012 Link to this post

    Hi Rasheed,

    Yes, it is possible to persist the state of RadAsyncUpload on postback. To see how, please take a look at the following articles:

    http://www.telerik.com/help/aspnet-ajax/asyncupload-persist-uploaded-files.html 
    http://demos.telerik.com/aspnet-ajax/upload/examples/async/persistuploadedfiles/defaultcs.aspx?product=asyncupload 

     
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rasheed
    Rasheed avatar
    32 posts
    Member since:
    Jan 2012

    Posted 26 Jan 2012 Link to this post

    thanks for your reply 

    i'm using Telerik.Web.UI_2011_1_315_Dev controls and the property your are talking about not supported in my version ins there any fix or anything i can do to accomplish what i want ?? 

    thank very much 
  5. Rasheed
    Rasheed avatar
    32 posts
    Member since:
    Jan 2012

    Posted 26 Jan 2012 Link to this post

    hi 
    I've upgraded my controls to the new version Telerik Q3 2011,also I've used postback triggers property but i'm facing a new problem which is after checking if the file existed or not, the add new record pop up template re opens again but the RadAsyncupload control is in it's default state.
    - my RadGrid is ajaxified 

    any help, please ? 

    thank you
  6. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 30 Jan 2012 Link to this post

    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
  7. Rasheed
    Rasheed avatar
    32 posts
    Member since:
    Jan 2012

    Posted 30 Jan 2012 Link to this post

    thank you very much 

    i'll give it a try 


    thanks again 
    rasheed samawi
  8. Pavani
    Pavani avatar
    9 posts
    Member since:
    Jul 2012

    Posted 31 Aug 2012 Link to this post

    Hi,


                  For me also the same problem. please see my grid

    <telerik:RadGrid ID="rgMoveOutCheckList" runat="server" OnItemDataBound="rgMoveOutCheckList_ItemDataBound"

    AutoGenerateColumns="false" Width="100%">

    <MasterTableView DataKeyNames="UploadedImage">

    <Columns>

    <telerik:GridTemplateColumn UniqueName="AttributeCondition" HeaderStyle-Width="130px" ItemStyle-Width="130px">

    <ItemTemplate>

    <asp:DropDownList ID="ddlCondition" DataTextField="Description" DataValueField="AttributeConditionId" AutoPostBack="true" OnSelectedIndexChanged="ddlCondition_SelectedIndexChanged"

    runat="server" Width="130px">

    </asp:DropDownList>

    <asp:RequiredFieldValidator ID="rfvCondition" runat="server" ControlToValidate="ddlCondition" ForeColor="Red" Text="*" InitialValue="0"></asp:RequiredFieldValidator>

    </ItemTemplate>

    </telerik:GridTemplateColumn>

    <telerik:GridTemplateColumn UniqueName="CAmount"HeaderStyle-Width="100px" ItemStyle-Width="100px">

    <ItemTemplate>

    <telerik:RadNumericTextBox ID="rntCAmount" MinValue="0" runat="server" SkinID="Required" Width="80px"></telerik:RadNumericTextBox>

    <asp:RequiredFieldValidator ID="rfvCAmount" runat="server" Text="*" ForeColor="Red"

    ControlToValidate="rntCAmount"></asp:RequiredFieldValidator>

    <asp:CompareValidator ID="cvCAmount" runat="server" ControlToValidate="rntCAmount"

    Text="*" Type="Currency" ForeColor="Red"Operator="DataTypeCheck"></asp:CompareValidator>

    </ItemTemplate>

    </telerik:GridTemplateColumn>

    <telerik:GridTemplateColumn>

    <ItemTemplate>

    <telerik:RadAsyncUpload runat="server" ID="rauAttribute" Width="150px"

    MaxFileInputsCount="1" AllowedFileExtensions="jpeg,jpg,gif,png,bmp" PostbackTriggers="rbSave" />

    </ItemTemplate>

    </telerik:GridTemplateColumn>

    </Columns>

    </MasterTableView>

    </telerik:RadGrid>

    I have a dropdown list with selectedindexchanged event. based on that i have set the textbox properties like enabled,values etc. but the problem is if i upload a file and select an item from dropdown list. the uploaded file is setting back to its original state  and grid header text is disappering. Iam assinging header text values in codebehind file ItemDataBound event. Iam using PostBackTriggers still it is not working . Please see my code and give me the solution.


    Thanks

  9. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 05 Sep 2012 Link to this post

    Hello Pavani,

    I setup a sample page from the provided code. Please review the attachment. Keep in mind that if you rebind the RadGrid on every postback you cannot keep the uploaded files.

    Regards,
    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.
  10. prabha
    prabha avatar
    22 posts
    Member since:
    Nov 2010

    Posted 24 Oct 2012 Link to this post

    Hi ,
    My scenerio is, I have two buttons with Rad Async upload. First button click, i did some calculation. I need to upload the file in second button click event. So the file is not retain in the second button click event.
    Also, I am  using Telerik.Web.UI_2010.3.1215.40_Dev controls and "Postback trigger" property is not supported in my version. in this case is there any fix ?? . Please give any suggestions

    Thanks & regards
    Prabha
  11. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 26 Oct 2012 Link to this post

    Hi Prabha,

     
    Yes indeed PostbackTriggers property was implemented in RadAsyncUpload in Q2 2011 and you will have you update the version of your control in order to use it.

    Hope this will explain the issue.

    Greetings,
    Plamen
    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.
  12. MAYIL
    MAYIL avatar
    2 posts
    Member since:
    Jul 2012

    Posted 01 Mar 2013 Link to this post

    Hi all, my scenario is different here. I need samples for two scenarios:
    
    1) I have RadListBox, based on the values selected, others controls (RadTextBox, RadComboBox,RadListBox, RadRadioListBox etc) will be visible to the user. If user made some changes on these controls and again changed the values of Main RadListBox, It should prompt the user that ‘ You have made some changes but not saved, do you still want to move away(select a new item)?’.
    2) Whenever user navigate away from one page to another page, it should prompt like: ‘Do you want to move away?’
    Thanks Regards, Mayil
  13. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Mar 2013 Link to this post

    Hello,

    Please have a look at the following code that matches your scenario.

    ASPX:
    <telerik:RadListBox ID="RadListBox1" runat="server" CheckBoxes="true" OnClientItemChecked="OnClientItemChecked"
        SelectionMode="Multiple" Width="200px">
        <Items>
            <telerik:RadListBoxItem runat="server" Text="Enable TextBox" />
        </Items>
    </telerik:RadListBox>
    <br />
    <telerik:RadTextBox ID="RadTextBox1" runat="server">
    </telerik:RadTextBox>

    JavaScript:
    <script type="text/javascript">
        function OnClientItemChecked(sender, args) {
            if (sender.findItemByText("Enable TextBox").get_checked() == true) {
                $find("RadTextBox1")._element.style.display = "block";
            }
            else {
                if (confirm(' You have made some changes but not saved, do you still want to move away(select a new item)?')) {
                    $find("RadTextBox1")._element.style.display = "none";
                }
                else {
                    sender.findItemByText("Enable TextBox")._checkBoxElement.checked = true;
                }
            }
        }
    </script>

    Thanks,
    Princy.
  14. Mayil
    Mayil avatar
    1 posts
    Member since:
    Mar 2013

    Posted 05 Mar 2013 Link to this post

    Hi Princy,

    Thanks for your reply. But I am looking for some thing about dynamic controls. I may not aware the controls name or id. The main RadListbox is static.

    On main RadListBox selected index changing, I need to find all the controls within a specified Div area. The controls may be a RadListBox(may be single/multi selection/checkbox enabled)/RadCompoBox(may be single/multi selection/checkbox enabled)
    /RadTextBox/RadRadioButtonList and check for the default value changes, if any of these control's default value changed, it should prompt the msg to user, if the user selected a different item in the Main  RadListBox.

    Pls help me on this.

    Thanks & Regards,
    Mayil
  15. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 06 Mar 2013 Link to this post

    Hi Mayil,

    In order to save the consistency of the thread could you please open a new support ticket for your case. You should handle every control change on the page explicitly. It is not possible to have generic approach for them.

    Regards,
    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017