Click here to Skip to main content
15,886,608 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am clicking on asp button on click. it completes its fuctionality i want to show message in a label that it is successfully completed!!
and message shud disapper after certain interval

I used
'Label1.Text = "Folder Deleted Successfully"
               'Threading.Thread.Sleep(5000)
               'Label1.Text = ""

but it actually stops the functionality

please help me do it on server side
Posted
Updated 19-Nov-11 2:34am
v2
Comments
demouser743 19-Nov-11 6:19am    
As you are using Thread.sleep after assigning the text this will always show you the latest text available i.e Empty string as you specified will be shown.
RaviRanjanKr 19-Nov-11 8:34am    
[Edited]Code is wrapped in "Pre" tag[/Edited]

Solution in JFIDDLE

http://jsfiddle.net/VPrEZ/3/[^]


XML
<script type="text/javascript" src="JScript.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            setTimeout(function() {
                fadeLabelOut();
            }, 5000);
        });

        function fadeLabelOut() {
            $('#<%= myLabel.ClientID %>').fadeOut(3000, function() {
                $(this).html(''); //reset the label after fadeout
            });
        }
    </script>


Download the script and include the script and test this works fine for me

http://docs.jquery.com/Downloading_jQuery[^]

Or include the script as specified and try this

C#
$(document).ready(function() {
    $('#<%= Label1.ClientID %>').fadeOut(3000, function() {
        $(this).html(""); //reset the label after fadeout
    });
});
 
Share this answer
 
v2
Try to add a timer programmatically on button click in button click event handler

In the same handler set the message to the label.

After the timer completes the interval ,Use OnTick event to disable the message

Try to remove the timer programmatically.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900