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

Added Custom Fields to RadUpload with OnClientAdded loses its value when user enters the wrong RadCaptcha value

5 Answers 104 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
sweta
Top achievements
Rank 1
sweta asked on 02 Mar 2011, 06:13 PM

Hello

i have added one Add Note' - link button, dropdown box and, 'Remove Note' - link button as Custom fields. when user clicks the 'Add Note' new textarea is displayed.  i have added these fields with OnClientAdded method to the Radupload control. i have RadCaptcha control on my page too. which is above the RadUpload control. when user enters the wrong Captcha value Error message displayed like 'Please Enter Correct word'. so first user enters the captcha value and then selects the file to upload. he adds note and select the value from the dropdown. but as he has entered the wrong captcha value error message is displayed. but the note is disappeared and dropdown box loses its selected value. i'm aware that at this time file selected is lost. and user have to select the file again. its a known limitation of the radupload. but i'm not aware that how the custom field will work.

Please help me to resolve the issue.

Thanks
Sweta

5 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 08 Mar 2011, 09:04 AM
Hello sweta,

This happens because RadCaptcha perform a full page postback should the user enters incorrect text. The full page postback will erase the value of RadUpload as well as the additional fields. In order to work that around please place the captcha inside a RadAjaxPanel, so that the upload is not modified should the user enter incorrect text.


Regards,
Genady Sergeev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Ryan Overton
Top achievements
Rank 2
answered on 18 Mar 2011, 11:27 PM
Hello,
I am having a similar issue and have tried your suggestions a couple of different ways to no avail. The first scenario, I put the captcha inside an updatepanel with the upload control and submit button outside and it caused validation but caused a full page post-back. I then tried placing the submit button inside the updatepanel, and this caused the desired effect with the captcha, except that since a full page post was not performed the file was not downloaded. Then I tried place all the controls inside the updatepanel, but on a failed captcha validation the upload file was not retained.

Are these 2 controls not meant to be used together? If they are, please provide an example of how I can use them together.

Thank you,
Ryan Overton
0
sweta
Top achievements
Rank 1
answered on 19 Mar 2011, 05:20 AM

 

Hello Ryan,

 

I have resolved the issue.it is a temporary solution but it worked for me. i have taken the two hidden controls. i fill the value in the hidden control when the page is postback in code-behind file. and i set the value in custom controls when these custom controls are created.

Thanks
Sweta

0
Genady Sergeev
Telerik team
answered on 24 Mar 2011, 12:55 PM
Hi Ryan Overton,

RadUpload and RadCaptcha are not compatible in the scenario that you have tried. In such cases, I suggest that you use RadAsyncUpload instead (which is capable of uploading files with Ajax). Example:

<form id="form1" runat="server">
    <asp:ScriptManager runat="server" ID="ScriptManager1">
    </asp:ScriptManager>
    <div>
        <asp:UpdatePanel runat="server" ID="UpdatePanel1">
            <ContentTemplate>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="SubmitInfo"
                    EnableClientScript="False" />
                <asp:Button runat="server" ID="Button1" Text="Postback" CausesValidation="true" ValidationGroup="SubmitInfo" />
                <telerik:RadCaptcha ID="RadCaptcha1" runat="server" ErrorMessage="Page not valid. The code you entered is not valid."
                    ValidationGroup="SubmitInfo">
                </telerik:RadCaptcha>
                <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1">
                </telerik:RadAsyncUpload>
                </div>
            </ContentTemplate>
        </asp:Update


Best wishes,
Genady Sergeev
the Telerik team
0
MJ
Top achievements
Rank 1
answered on 25 Jan 2012, 09:45 PM
Hi Sweta,

I am also using the work around similar to yours regarding the custom controls added to the Rad uplaod.
Where are the custom controls created? I am trying to set the values of the custom controls in OnClientAdded inside the script.
Are you able to set the value for FileUpload control using the hidden field value

Regards,
MJ
Tags
Upload (Obsolete)
Asked by
sweta
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Ryan Overton
Top achievements
Rank 2
sweta
Top achievements
Rank 1
MJ
Top achievements
Rank 1
Share this question
or