Reputation: 199
I am sending an email and it takes a few seconds to collect data, format it, verify it, and send it, so for user interaction I have placed a gif image of a progess bar for user to wait,.
I have made this image visible property to false in design mode, now i want to show this image when user clicks send email and hide it when image successfully sent. I have written email sending code and it works fine, and at top of that I wrote image1.visible=true
and at bottom of email sending code I image1.visible=false
and displayed email sent successfully in a label.
However, image is not displaying. Please help or any alternative?
Upvotes: 0
Views: 1156
Reputation: 7525
I would recommended you to use UpdateProgress. here is the sample:
<asp:UpdatePanel runat="server" ID="upchk1">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button2" />
//you can even specify button which is outside of UpdatePanel.
</Triggers>
<ContentTemplate>
<asp:Button ID="Button2" runat="server" Text="Check!" OnClick="Button2_Click" />
<asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="upchk1">
<ProgressTemplate>
<asp:Image ID="Image1" ImageUrl="Style/spinner.gif" runat="server" /> Checking...
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
so, UpdateProgress's image (Image1) only will be visible while completing the task.
Upvotes: 2