Solved

Image ProgressBar for each asp.net control script?!

Posted on 2011-09-20
12
205 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
Comment Utility
That sounds like you need different, conditional triggers for the UpdatePanel...
0
 

Author Comment

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

Accepted Solution

by:
Bob Learned earned 500 total points
Comment Utility
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
 

Author Comment

by:dejandejanovic
Comment Utility
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
Comment Utility
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
Comment Utility
Getting error:
Error Creating Control - UpdatePanel2Type 'System.Web.UI.UpdatePanel' does not have a public property named 'Button'.'
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
...inside the <ContentTemplate>...
0
 

Author Comment

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

Expert Comment

by:Bob Learned
Comment Utility
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
Comment Utility
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
Comment Utility
<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
Comment Utility
complete.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now