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

Client-Side progressData Object Doesn't Work

6 Answers 112 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Don
Top achievements
Rank 1
Don asked on 04 Aug 2009, 08:54 PM

I've written a client-side javascript method to handle the OnClientProgressUpdating event for my ProgressArea.  The signature looks as follows:

 

 

    function progressUpdating(progressArea, args) {

 

 

          alert(args.get_progressData().RadUpload.RequestSize);

 

 

However, I can't seem to get any information for the "RadUpload" object.  When I inspect the "args" object using the debugger, here is what it contains:

 

     ? args.get_progressData()

     {...}

     CurrentOperationText: "Uploaded SendACHFile.txt"

     InProgress: true

     PrimaryPercent: "1"

     PrimaryTotal: "588480"

     PrimaryValue: "8192"

     ProgressCounters: true

     SecondaryPercent: "1"

     SecondaryTotal: "588480"

     SecondaryValue: "8192"

     TimeElapsed: "00:00:01s"

 

Where is the RadUpload object?  This does not match the documentation.  There are supposed to be additional properties.  How can I get access to the "RadUpload" object?

The above code throws the following exception:
    Microsoft JScript runtime error: 'get_progressData().RadUpload.RequestSize' is null or not an object

6 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 05 Aug 2009, 11:41 AM
Hi Don,

The OnClientProgressUpdating client event fires for both the ProgressArea and the ProgressManager. The event arguments have different methods depending on which is the sender. Please subscribe to the OnClientProgressUpdating event of the progress manager to get that properties working.

Kind regards,
Veselin Vasilev
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
Don
Top achievements
Rank 1
answered on 05 Aug 2009, 01:20 PM
I am already subscribing to that event:

 

<telerik:RadProgressArea ID="RadProgressArea1" runat="server" DisplayCancelButton="False"

 

 

OnClientProgressUpdating="progressUpdating" ProgressIndicators="TotalProgressBar, TotalProgress, TotalProgressPercent, RequestSize, FilesCountBar, FilesCount, FilesCountPercent, SelectedFilesCount, TimeElapsed, TimeEstimated">

 


and the javascript method is as follows:

 

<script type="text/javascript">

 

 

function progressUpdating(progressArea, args) {

 

alert(args.get_progressData().RadUpload.RequestSize);


As previously stated, the "RadUpload" property does not exist.  Please advise.

Thanks
0
Don
Top achievements
Rank 1
answered on 05 Aug 2009, 06:40 PM
I may have found the answer to this issue.  I am using a custom progress area, and not the file upload progress area.  When using a custom progress area, it looks like the file properties associated with the progressData object do not exist.

Is there a way to extend the progressArea class such that I can add my own custom properties to it?
0
Genady Sergeev
Telerik team
answered on 10 Aug 2009, 01:36 PM
Hello Don,

You can add your custom properties to the progress area the following way:

<script type="text/javascript"
            Telerik.Web.UI.RadProgressArea.prototype.ob = new Object(); 
            Telerik.Web.UI.RadProgressArea.prototype.ob.a = 5
        </script> 
 

and then use the added property like this:

 
 
<script type="text/javascript"
            function progressUpdating(sender, args) { 
                alert(sender.ob.a); 
            } 
        </script> 

I hope this help you get started.

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
Don
Top achievements
Rank 1
answered on 11 Nov 2009, 11:43 AM
The custom property listed below is scripted on the client at runtime.  Is there a way to get to this property on the server side at run time?  I need to b e able to pass structured information from the server back to the client, to update a custom progress monitor that uses a template.
0
Genady Sergeev
Telerik team
answered on 16 Nov 2009, 07:49 PM
Hi Don,

If I have understood you correctly, you want to script a client side property from the ServerSide. Is that correct? You can do that in the following way:

StringBuilder sb = new StringBuilder();
  sb.Append("Telerik.Web.UI.RadProgressArea.prototype.ob = new Object();");
  sb.Append("Telerik.Web.UI.RadProgressArea.prototype.ob.a = 5;");
  
ClientScript.RegisterStartupScript(this.GetType(), "Page_Load", sb.ToString(), true);

This is very trivial example, however you can register whatever you want, even complex object serialized using JSON.

Kind regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Upload (Obsolete)
Asked by
Don
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Don
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or