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

RadProgressArea in Grid - URGENT

6 Answers 152 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
maha
Top achievements
Rank 1
maha asked on 13 Mar 2009, 12:26 AM
I have a RadProgressArea inside a grid.

For each item in the grid , i need to show the RadprogressArea.

Progress should be updated every second. Values are going to be based on a dataSource
What need to be done to have the RadprogressArea updated every second.

Can i have a sample code for it.

I saw in the demo and some other samples that RadprogressArea has two ProcessBar to show the status. Is there a way to have just one progress bar to display the progress status.


6 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 16 Mar 2009, 03:23 PM
Hi Maha,

Have you considered using client or server binding to a WebService to accomplish this task? Here are a couple of online demos of the product which illustrate both approaches:

http://demos.telerik.com/aspnet-ajax/grid/examples/client/livedata/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/aspajaxgridapplication/defaultcs.aspx?product=grid

Note that you can replace the Change column with your custom process indicator and update it when a certain interval of time expires to reflect the status of a certain task. I hope that these samples can become basis for your custom implementation.

Best regards,
Sebastian
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
maha
Top achievements
Rank 1
answered on 16 Mar 2009, 03:36 PM
I am not using webservice.
I added RadProgressArea in the Grid. I set a timer for an interval of 5 seconds to update the grid.

Grid is inside UpdatePanel.

but I am getting exception.
htmlfile: Unknown runtime error

Is there a way to update the grid and radprogressarea if there is a change in the database.

DataSource for the Grid is ObjectDataSource.




0
Sebastian
Telerik team
answered on 19 Mar 2009, 11:52 AM
Hello maha,

Unfortunately from the information so far I am not exactly sure how you would like to use RadProgressArea individually inside your grid instance (without RadUpload). Can you please elaborate in more details on this subject in order to advice you further?

In case you would like to use RadProgressArea for RadUpload file indicator, review the following integration demo of RadGrid, RadUpload and RadAjax:

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/raduploadinajaxifiedgrid/defaultcs.aspx?product=grid

Best regards,
Sebastian
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
maha
Top achievements
Rank 1
answered on 19 Mar 2009, 02:37 PM
Based on database process, i am showing the radprogressarea in the grid.

I had grid inside Update Panel and a timer set which will update the grid values every 3 seconds.
All the values in the grid gets updated , but just not the progressarea.
I am not using Rad Upload.
Progress bar still shows the old values.
Is there a way to update the progress area in the server side.

This is my Javascript
function myOnClientProgressBarUpdating(radProgressArea, args)  
{  
    //The primary progress bar will be horizontal (default)  
    if (args.get_progressBarElementName() == "PrimaryProgressBar")  
  {  
      radProgressArea.updateHorizontalProgressBar(  
          args.get_progressBarElement(), args.get_progressValue());  
      //Skip the default progress bar updating  
      args.set_cancel(true);  
  }  
 

Below is my radprogressarea inside the grid.
<telerik:GridTemplateColumn HeaderText="Percentage" UniqueName="TemplateColumn">  
                                            <ItemTemplate> 
                                                    <telerik:RadProgressArea id="Area1" runat="server" Skin="Outlook" InProgress="true" onclientprogressbarupdating="myOnClientProgressBarUpdating" >                                                      
                                                     <ProgressTemplate> 
                                                        <ul class="ruProgress" style="padding:1px">  
                                                            <li class="ruFilePortion" style="margin:0px">  
                                                                Completed <span id="PrimaryPercent" runat="server" ></span>%   
                                                               (<span id="PrimaryValue" runat="server" ></span> ) Total    
                                                                <span id="PrimaryTotal" runat="server" ></span>  
                                                                <div id="PrimaryProgressBarOuterDiv" class="ruBar" runat="server" style="height:10" > 
                                                                    <div id="PrimaryProgressBarInnerDiv" runat="server" style="width:200"><!-- --></div>  
                                                                </div>   
                                                            </li> 
                                                       </ul> 
                                                    </ProgressTemplate> 
                                                </telerik:RadProgressArea>             
                                            </ItemTemplate>   
                                              
                                    </telerik:GridTemplateColumn> 

This is my codebehind.
 protected void LooongMethodWhichUpdatesTheProgressContext(RadProgressArea area,string total,string current)  
        {  
            RadProgressContext progress = RadProgressContext.Current;  
              
            progress.PrimaryTotal = total.ToString();  
            progress.PrimaryPercent = current.ToString();  
            progress.PrimaryValue = current.ToString();  
 
            StringWriter writer = new StringWriter();  
            progress.Serialize(writer);  
            //mainScript.Append(String.Format("function displayProgressAreas() {{ {1};$find('{0}').update(rawProgressData);}}", area.ClientID, writer.GetStringBuilder().ToString()));  
            mainScript.Append(String.Format("{1};$find('{0}').update(rawProgressData);", area.ClientID, writer.GetStringBuilder().ToString()));  
        }  
 
        
        
        
        
        
        protected void radgProcessorStatus_ItemDataBound(object sender, GridItemEventArgs e)  
        {  
            RadProgressArea area = (RadProgressArea)(e.Item.FindControl("Area1"));  
 
            if (area != null)  
                LooongMethodWhichUpdatesTheProgressContext(area,e.Item.Cells[4].Text,e.Item.Cells[5].Text);  
        }  
 
        protected void radgProcessorStatus_DataBound(object sender, EventArgs e)  
        {     
              
 
            mainScript.Append("}");  
            string script = "function displayProgressAreas() {";  
            string scriptFinal = string.Concat(script, mainScript);  
            string script1 = "Sys.Application.add_load(function(){ displayProgressAreas();});";  
            string script2 = string.Empty;  
            if (!Page.IsPostBack)  
                script2 = String.Concat("<script type='text/javascript'> ", scriptFinal, script1, " </script>");  
 
            else 
            {  
                script2 = String.Concat("<script type='text/javascript'> ", scriptFinal, script1);  
                string unloadScript = "Sys.Application.add_unload(function(){ displayProgressAreas();});";  
 
                script2 = String.Concat("<script type='text/javascript'> ", script2, unloadScript, " </script>");  
            }  
            ClientScript.RegisterStartupScript(this.GetType(), "DisplayProgressAreas", script2, false);  
              
        } 
PrimaryTotal,PrimaryPercent and PrimaryValue is getting the correct values when it is debugged, but not showing up the new values in the page.

0
maha
Top achievements
Rank 1
answered on 23 Mar 2009, 04:59 PM
Can someone help.
0
Sebastian
Telerik team
answered on 24 Mar 2009, 12:17 PM
Hello maha,

Thank you for the clarification. Unfortunately from the information/code snippets provided so far I am not able to determine the exact cause of the issue you are facing. The best means to progress in our investigation is to isolate a stripped working version of your project and send it enclosed to a regular support ticket. I will examine your complete implementation in detail and will get back to you with my findings.

Kind regards,
Sebastian
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
maha
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
maha
Top achievements
Rank 1
Share this question
or