This is a migrated thread and some comments may be shown as answers.

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

13 Answers 621 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Rasheed
Top achievements
Rank 1
Rasheed asked on 26 Jan 2012, 05:02 AM
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 

13 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 26 Jan 2012, 12:51 PM
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
0
Rasheed
Top achievements
Rank 1
answered on 26 Jan 2012, 04:35 PM
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 
0
Rasheed
Top achievements
Rank 1
answered on 27 Jan 2012, 03:38 AM
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
0
Bozhidar
Telerik team
answered on 30 Jan 2012, 02:32 PM
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
0
Rasheed
Top achievements
Rank 1
answered on 30 Jan 2012, 04:48 PM
thank you very much 

i'll give it a try 


thanks again 
rasheed samawi
0
Pavani
Top achievements
Rank 1
answered on 31 Aug 2012, 08:53 AM
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

0
Peter Filipov
Telerik team
answered on 05 Sep 2012, 10:09 AM
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.
0
prabha
Top achievements
Rank 1
answered on 24 Oct 2012, 08:36 AM
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
0
Plamen
Telerik team
answered on 26 Oct 2012, 09:03 AM
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.
0
MAYIL
Top achievements
Rank 1
answered on 01 Mar 2013, 06:22 AM
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
0
Princy
Top achievements
Rank 2
answered on 04 Mar 2013, 10:22 AM
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.
0
Mayil
Top achievements
Rank 2
answered on 05 Mar 2013, 06:19 AM
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
0
Peter Filipov
Telerik team
answered on 06 Mar 2013, 08:31 AM
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.
Tags
AsyncUpload
Asked by
Rasheed
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Rasheed
Top achievements
Rank 1
Pavani
Top achievements
Rank 1
Peter Filipov
Telerik team
prabha
Top achievements
Rank 1
Plamen
Telerik team
MAYIL
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Mayil
Top achievements
Rank 2
Share this question
or