Solved

hide a label on a timer

Posted on 2011-09-14
4
237 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…

757 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

20 Experts available now in Live!

Get 1:1 Help Now