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

RadProgressArea does not appear after client-side validation

7 Answers 193 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Nick Jensen
Top achievements
Rank 1
Nick Jensen asked on 28 Apr 2009, 10:05 AM
Hi there,

I've spent hours trying to discover what can be causing this problem and have not managed to find the solution anywhere in the Telerik forums or Knowledge Base yet.

I have a RadProgressArea displaying progress for a single file upload field, which uses an ordinary <input type="file" /> control. The progress area displays correctly when the page is posted back when hitting an Upload button (the button has a causesvalidation="false" attribute so it doesn't trigger the validator mentioned below).

The page also contains a textbox with a (clientside) RequiredFieldValidator, and a Submit button. If the Submit button is clicked when the textbox is empty, the validator correctly prevents the postback from occurring. If the Upload button is subsequently clicked, the upload works (the file size is eventually displayed back to the screen when the upload is complete) but the RadProgressArea does not get displayed.

I'm testing locally so I tend to use large files to test with, 200-300MB

Here's my code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RadUploadTest._Default" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<%@ register tagprefix="rad" assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" %> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
   <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
      <div> 
         <input type="file" id="input" runat="server" /> 
         <asp:button id="btn" runat="server" onclick="ClickUpload" text="Upload" causesvalidation="false" /> 
 
         <asp:scriptmanager id="sm" runat="server"></asp:scriptmanager> 
         <rad:radprogressarea id="radProgressArea" runat="server" style="z-index: 100;" /> 
         <rad:radprogressmanager id="radProgressManager" runat="server" /> 
 
         <br /> 
         <br /> 
 
         File size: <asp:literal id="literalFileSize" runat="server" /> 
 
         <br /> 
         <br /> 
         <br /> 
         <br /> 
 
         Description: 
         <asp:textbox id="textDescription" runat="server" /> 
         <asp:requiredfieldvalidator id="valDescriptionRequired" 
               controltovalidate="textDescription" 
               display="Dynamic" 
               runat="server" 
               text="*" /> 
 
          <asp:button id="btnAnotherPostback" runat="server" text="Postback" onclick="ClickPostback" /> 
      </div> 
   </form> 
</body> 
</html> 

using System; 
using System.Web.UI; 
 
using Telerik.Web.UI; 
 
namespace RadUploadTest { 
 
   public partial class _Default : Page { 
 
      protected void ClickUpload(object sender, EventArgs e) { 
         RadUploadContext uploadContext = RadUploadContext.Current; 
 
         if (uploadContext != null && uploadContext.UploadedFiles.Count == 1) { 
            UploadedFile file = uploadContext.UploadedFiles[0]; 
 
            if (file != null
               literalFileSize.Text = file.ContentLength.ToString(); 
         } 
      } 
 
      protected void ClickPostback(object sender, EventArgs e) { 
         Page.Validate(); 
      } 
 
   } 
 

Can anyone help me out?

Thanks
Nick

7 Answers, 1 is accepted

Sort by
0
ManniAT
Top achievements
Rank 2
answered on 28 Apr 2009, 11:32 PM
Did you enable larger uploads in web.config?
I had such a problem (no progress) in testing locally. (Where I used an xlarge file exceeding my limits)
It drove me crazy - finally I worked out that when the filesize exceeds the limit no panel is shown.
After I did not suspend the upload (before I always did since I got no panel) - an errormessage showed me, that the file was to large :)

Just an idea

Manfred
0
Nick Jensen
Top achievements
Rank 1
answered on 28 Apr 2009, 11:47 PM
Hi Manfred,

Thanks for your suggestion. As I've said I can successfully upload large files, and the RadProgressArea does normally get displayed. The only time it is not displayed is after another control on the page has caused validation (clientside or serverside it turns out).

So if I upload as the first action on the page the progress area is displayed. If I attempt to submit, discover a problem elsewhere on the page with validation and then upload, the progress area is not displayed. However the upload does work, just invisibly.

I did actually come up against the issue you describe while trying to recreate the error in a sample project, but eventually I did get a sample running where I can replicate the error, which is the code I posted. For the record, here's my Web.Config - it's basically the Web.Config that Visual Studio generates, plus allowance for increased file size and including the RadUpload references:

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
        <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
            <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
                <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
                <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
                    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> 
                    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
                    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
                    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
                </sectionGroup> 
            </sectionGroup> 
        </sectionGroup> 
    </configSections> 
    <appSettings/> 
    <connectionStrings/> 
    <system.web> 
        <compilation debug="true"
            <assemblies> 
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
                <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
                <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> 
            </assemblies> 
        </compilation> 
        <authentication mode="Windows"/> 
        <pages> 
            <controls> 
                <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
                <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
            </controls> 
        </pages> 
        <httpHandlers> 
            <remove verb="*" path="*.asmx"/> 
            <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
            <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
            <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 
 
            <!-- Telerik RadUpload reference --> 
            <add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler, Telerik.Web.UI" validate="false"/> 
        </httpHandlers> 
        <httpModules> 
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
 
            <!-- Telerik RadUpload reference --> 
            <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI"/> 
        </httpModules> 
 
        <!-- Allow large files to be uploaded --> 
        <httpRuntime maxRequestLength="1024000" executionTimeout="3600"/> 
    </system.web> 
    <system.codedom> 
        <compilers> 
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
                <providerOption name="CompilerVersion" value="v3.5"/> 
                <providerOption name="WarnAsError" value="false"/> 
            </compiler> 
        </compilers> 
    </system.codedom> 
    <system.webServer> 
        <validation validateIntegratedModeConfiguration="false"/> 
        <modules> 
            <remove name="ScriptModule"/> 
            <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
        </modules> 
        <handlers> 
            <remove name="WebServiceHandlerFactory-Integrated"/> 
            <remove name="ScriptHandlerFactory"/> 
            <remove name="ScriptHandlerFactoryAppServices"/> 
            <remove name="ScriptResource"/> 
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
            <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
        </handlers> 
    </system.webServer> 
    <runtime> 
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
            <dependentAssembly> 
                <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/> 
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> 
            </dependentAssembly> 
            <dependentAssembly> 
                <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/> 
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/> 
            </dependentAssembly> 
        </assemblyBinding> 
    </runtime> 
</configuration> 
 

0
Genady Sergeev
Telerik team
answered on 30 Apr 2009, 09:22 AM
Hello Nick Jensen,

We have reproduced the issue too, however if the validator fails and then you enter correct values for the validation to pass, the progress area is shown. The only case when it is not present, is when the validation on the page has failed but despite that the page was submitted. We will investigate on why this is happening.

Kind regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Nick Jensen
Top achievements
Rank 1
answered on 30 Apr 2009, 10:14 PM
Hi there Genady, thanks for your reply,

Yes I had also noticed that fulfilling the requirements of a client-side validator would allow the progress area to be displayed.

Also interesting, if there is a server-side validator that fails on postback, subsequent attempts to upload will still not have the progress area displayed, so it's not only client-side validators as I had first thought. But if the field (for example a text field) has its value changed - even if the new value does not fulfil the server-side requirements - then the validator error message will disappear and the progress area will be displayed when uploading.

I look forward to hearing what you can find out.

Nick
0
Nick Jensen
Top achievements
Rank 1
answered on 05 May 2009, 09:12 PM
Hi team,

Have you managed to get any further with this? Any ideas of a workaround?

Thanks,
Nick
0
Accepted
Genady Sergeev
Telerik team
answered on 13 May 2009, 08:44 AM
Hi Nick Jensen,

We have researched the case and managed to find a workaround, modify the declaration of the button with CausesValidation = false the following way:

<asp:Button
    runat="server"
    ID="BtnUpload"
    Text="Upload"
    CausesValidation="false"
    OnClientClick="return Page_IsValid=true;" />

When the page is submitted, the Progress Area checks the Page_IsValid property, if it is valid - start monitoring, if it is not - return. The problem is that, once the Page_IsValid is set to false because of the failed validation, there is no other way to check whether we have clicked a button with CausesValidation="false". This is why we explicitly set the Page_IsValid to true in the button declaration.

You can find sample project as an attachment.

Kind regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Nick Jensen
Top achievements
Rank 1
answered on 13 May 2009, 09:17 PM
Perfect!

Thanks very much for your help, this has given me the behaviour I expected.

Nick
Tags
Upload (Obsolete)
Asked by
Nick Jensen
Top achievements
Rank 1
Answers by
ManniAT
Top achievements
Rank 2
Nick Jensen
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or