Solved

Image ProgressBar for each asp.net control script?!

Posted on 2011-09-20
12
211 Views
Last Modified: 2013-11-05
Hello,
I'm testing below Image ProgressBar. I'm trying to add, for each button job (below codes), image progress bar. At the moment if I run Button1, or 2 both Image ProgressBars are running. ButI want to, if run Button1 then only one progressbar should run.

Need help, tips, etc.

<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel id="updatepanel1" runat="server">
    <ContentTemplate>
    <div>
      <asp:Button ID="Button1" runat="server" Text="Button" />
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
        <ProgressTemplate>
        <img alt="" class="style1" src="test.gif" />
        </ProgressTemplate>
        </asp:UpdateProgress>
     </div>
    </ContentTemplate>
    </asp:UpdatePanel>

        <asp:UpdatePanel id="updatepanel2" runat="server">
    <ContentTemplate>
    <div>
        <asp:Button ID="Button2" runat="server" Text="Button" />
        <asp:UpdateProgress ID="UpdateProgress2" runat="server">
        <ProgressTemplate>
        <img alt="" class="style1" src="test.gif" />
        </ProgressTemplate>
        </asp:UpdateProgress>
     </div>
     </ContentTemplate>
     </asp:UpdatePanel>
     </form>

Open in new window


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

Open in new window



Thank you in advance for help to anyone.
0
Comment
Question by:dejandejanovic
  • 7
  • 5
12 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 36569756
That sounds like you need different, conditional triggers for the UpdatePanel...
0
 

Author Comment

by:dejandejanovic
ID: 36572102
TheLearnedOne
Not understand about Triggers, do you have an example ?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 36572845
That would be AsyncPostBackTriggers for the UpdatePanel.

AsyncPostBackTrigger Class
http://msdn.microsoft.com/en-us/library/system.web.ui.asyncpostbacktrigger.aspx

You might need to set UpdatePanel.UpdateMode to Conditional, instead of the default of Always.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dejandejanovic
ID: 36582736
I have write below code. But, still when press one of button, BOTH images are running. Any idea what could be wrong written ?

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

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 36582788
It might be that the button is causing a post-back, which is the trigger for the UpdatePanel to update.  What happens if you move the buttons inside of the UpdatePanel?
0
 

Author Comment

by:dejandejanovic
ID: 36582854
Getting error:
Error Creating Control - UpdatePanel2Type 'System.Web.UI.UpdatePanel' does not have a public property named 'Button'.'
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 36582862
...inside the <ContentTemplate>...
0
 

Author Comment

by:dejandejanovic
ID: 36582932
Ups, begginer mistake, but still running both images.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 36673695
I don't have the luxury of a lot of time to research this, so it might help if you could cobble together a small test web application, and upload to ee.stuff.com.
0
 

Author Comment

by:dejandejanovic
ID: 36711383
Not worries anymore, I have found solution.

Thank you for your effort, and you have still help, as I was start thinking more deeper.
0
 

Author Comment

by:dejandejanovic
ID: 36711393
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" >

Open in new window


Entire UpdateProgress code must be outside of UpdatePanel.
0
 

Author Closing Comment

by:dejandejanovic
ID: 36711400
complete.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question