Solved

hide a label on a timer

Posted on 2011-09-14
4
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

696 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