Solved

Image ProgressBar for each asp.net control script?!

Posted on 2011-09-20
12
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

635 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