Solved

hide a label on a timer

Posted on 2011-09-14
4
241 Views
Last Modified: 2012-05-12
When user clicks submit button I display a message like "Changes saved succefsully". I would like this to be :
1) either gone after 3 seconds
or
2) when the user clicks on submit again, on client side before post back happens, I want this label to be hidden (so that when the error message shows on a required field validator the success messgae is still not visible from previous click. Please help. Thanks
0
Comment
Question by:TrialUser
4 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36540707
after displaying the message
setTimeout("hideMessage()", 3000);


function hideMessage()
{
   //code to hide the message
}
0
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 500 total points
ID: 36540834
Hi,

You can clear that message on event "OnClientClick" of the submit button.
function ClearMessage()
{
                var btn=document.getElementById('<%=b1.ClientID%>');
                 btn.value=" ";
 }

<asp:Button id="b1" Text="Submit" runat="server" OnClientClick="ClearMessage()" />

Regards,
Ram
0
 
LVL 16

Expert Comment

by:disrupt
ID: 36543161
see the code below using jquery:

jquery reference:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
$("#<%= button.ClientID %>").click(function() {
window.setInterval(clear, 3000);
});

function clear() {
$("#<%= lbl.ClientID %>").text("");
}

Open in new window

0
 

Author Closing Comment

by:TrialUser
ID: 36545925
thx
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

772 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