Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Image ProgressBar for each asp.net control script?!

Posted on 2011-09-20
12
Medium Priority
?
218 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 2000 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

Independent Software Vendors: 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!

Question has a verified solution.

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

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

886 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