Solved

Image ProgressBar for each asp.net control script?!

Posted on 2011-09-20
12
209 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Log4Net custom Appender not being fired. 5 74
Remove a text string from the end of another string 5 29
asp.net mvc return json 2 52
Json and asp.net mvc 2 43
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

947 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

22 Experts available now in Live!

Get 1:1 Help Now