Click here to Skip to main content
15,916,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I'm testing below Image ProgressBar. I'm trying to add, for each button job (below second codes), image progress bar. At the moment if I run Button1, or button2 both Image ProgressBars are running. But I want to, if run Button1 then only one progressbar could run.

Trying also with AsyncPostBackTrigger, and changing UpdatePanel to UpdateMode="Conditional"> ?!

Need help, tips, etc

ASP.NET
<form id="form1"  runat="server">    
<asp:ScriptManager ID="ScriptManager1" runat="server">    
    
<div>    
  
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">    
  
<triggers>    
<asp:AsyncPostBackTrigger ControlID="button1" />    
</triggers>    
<contenttemplate>    
<asp:Button ID="Button1" runat="server" Text="Button" />    
<asp:UpdateProgress ID="UpdateProgress1" runat="server">    
<progresstemplate>    
<img alt="" class="style1" src="ajax-loader.gif" />    
</progresstemplate>    
    
</contenttemplate>    
    
</div>    
  
<div>    
  
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">    
  
<triggers>    
<asp:AsyncPostBackTrigger ControlID="button2" />    
</triggers>    
<contenttemplate>    
<asp:Button ID="Button2" runat="server" Text="Button" />    
<asp:UpdateProgress ID="UpdateProgress2" runat="server">    
<progresstemplate>    
  
<img alt="" class="style1" src="ajax-loader1.gif" />    
</progresstemplate>    
    
</contenttemplate>    
    
</div>    
</form>  


VB
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click    
System.IO.File.Copy("J:\PROGRAMI\SQL, VISUAL\SQLEXPRADV_server_x86_ENU.exe", "C:\Documents and Settings\DEJANC\Desktop\test.exe")    
End Sub    
  
  
Protected Sub Button2_Click(sender As Object, e As System.EventArgs) Handles Button2.Click    
System.IO.File.Copy("J:\PROGRAMI\SQL, VISUAL\SQLEXPRADV_server_x86_ENU.exe", "C:\Documents and Settings\DEJANC\Desktop\test.exe")    
End Sub  


Thank you in advance for help to anyone!
Posted

1 solution

Hi,

Here I tried some code for your requirement.

to show multiple images on running process.But I used Jquery for that

If you try this you must like way of Jquery.

HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script language ="javascript" >
        function f1() {
            frstcpy("frstproc","Yes");
            jQuery.post("default11.aspx?action=cpy", { name: "fileone" }, function (data) {
                frstcpy("frstproc", "No");
            });
        }
        function f2() {
            frstcpy("scndproc", "Yes");
            jQuery.post("default11.aspx?action=cpy", { name: "filetwo" }, function (data) {
                frstcpy("scndproc", "No");
            });
        }
        function frstcpy(tid, opt) {
            if (opt == "Yes") {
                $("#" + tid).html("copying.....");
            }
            else {
                $("#" + tid).html("");
            }
        }
    </script>
</head>
<body >
    <form id="form1" runat="server">
    <div>
       <div id="frstresdiv">
          <input  type ="button" value ="copyfileone" id="btncopyone" onclick="f1()" />
          <br />
          <div id="frstproc"></div>
       </div><br />
        <div>
          <input type ="button" value ="copyfiletwo" id="btncopytwo" onclick ="f2()" />
          <br />
            <div id="scndproc"></div>
        </div>
    </div>
    </form>
</body>
</html>


And code behind file contains following code

C#
protected void Page_Load(object sender, EventArgs e)
{
    if (Request.QueryString["action"] != null)
    {
        Response.Clear();
        Thread.Sleep(3000);
        Response.End();
    }
}


Here I used div tag html instead of this you can display image also.

step into Jquery its really good experience to develop effective outputs


All the Best
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900