Progress bar Silver light javascript exception

Last post 03-10-2009, 10:03 AM by wassimsa. 2 replies.
Sort Posts: Previous Next
  •  03-10-2009, 8:19 AM 49677

    Progress bar Silver light javascript exception

    Hello,
    I am trying to write a javascript to display a progress bar in certain location on the page.
    I keep getting a javascript exception and the upload halts sometimes at 60% sometime 80% sometime 96%. There i no problem with smaller file sizes to test this try to upload the ajaxuploader.zip file which is around 3.7MB
    this is the exception i get
    Line:1
    Char:1
    Error:Unhandled Error in SilverLight 2 Application Eval Failed. at System.Window.Browser.HtmlWindow.Eval(String code)
    at SilverLight.FileItem.<>c_DisplayClassf.<FireEvent>b__e()
    Code:0
     

    <head runat="server">

    <title>Untitled Page</title>

    <style type="text/css">

    #mContainer {

    position:relative;

    width:200px;

    height:15px;

    padding:0px;

    border-top:1px solid #000000;

    border-bottom:1px solid #000000;

    }

    #gradient {

    position:absolute;

    top:0px;

    left:0px;

    width:200px;

    height:15px;

    background-image:url("gradient.gif");

    background-repeat:no-repeat;

    }

    #mask {

    position:absolute;

    font-size:1px;

    width:200px;

    height:15px;

    background-color:#FFFFFF;

    left:0px;

    top:0px;

    }

    #progressIndicator {

    position:absolute;

    top:0px;

    left:0px;

    width:200px;

    height:15px;

    font-family:verdana;

    font-weight:bold;

    color:#C0C0C0;

    font-size:10pt;

    text-align:center;

    }

     

    </head>

    <script type="text/javascript">

    function CuteWebUI_AjaxUploader_OnProgress(enable,filename,begintime,uploadedsize,totalsize)

    {

    var hidden=this;

    if(enable)

    {

    if(totalsize)

    {

    // document.getElementById("Text1").value=Math.floor(100*uploadedsize/totalsize)+'%'; //filename+" - "+Math.floor(100*uploadedsize/totalsize)+'%'

     

    curWidth = parseInt(document.getElementById("mask").offsetWidth);

    curLeft = parseInt(document.getElementById("mask").offsetLeft);

    curWidth=curWidth-parseInt(Math.floor(100*uploadedsize/totalsize));

    curLeft =curLeft+parseInt(Math.floor(100*uploadedsize/totalsize));

    if(curLeft >=201) {

    clearInterval(mInterval);

    document.getElementById("mask").style.display = "none";

    return;

    }

     

    document.getElementById("mask").style.left = curLeft + "px";

    if(parseInt(document.getElementById("mask").offsetWidth)>10)document.getElementById("mask").style.width = curWidth + "px";

    document.getElementById("progressIndicator").innerHTML = Math.floor((curLeft / parseInt(document.getElementById("gradient").offsetWidth))*100) + "%";

     

     

     

     

     

     

     

    }

    else

    {

    }

    }

    else

    {

    }

    return false; //hide the default ui.

    }
     
    </script>
     
     
    Please advice
    Thanks
  •  03-10-2009, 8:48 AM 49683 in reply to 49677

    Re: Progress bar Silver light javascript exception

    I , I think your function just throws error.
     
    You need use try/catch block and watch what error your code throws.
     
    Regards,
    Terry
     
  •  03-10-2009, 10:03 AM 49686 in reply to 49683

    Re: Progress bar Silver light javascript exception

    problem on my side
    thanks
View as RSS news feed in XML