Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To solve the problem I put a hidden field on my Master Page with id='hfSaveMessageText'. This will hold the message to display, if any. I also put a span with id='mpSaveSpot' and the appropriate styling on the MasterPage. This is where my messages will show up.</p> <p>I then created a sever-side method that accepts a System.Web.UI.Page and a string message to display. The method gets a reference to the hidden field on the master page and sets the value to the message that the user passes in (e.g.: "Record Deleted" or "Email Sent"). </p> <p>The following javascript runs on every asynchronous postback endRequest to see if there is a message that needs to be displayed. If so, I display the message and fade it out over 4.5 seconds (courtesy of JQuery fadeOut).</p> <pre><code>//--Get an instance of the PageRequestManager so we can // designate an end-request handler var prm = Sys.WebForms.PageRequestManager.getInstance(); //--designed the displayFadeoutMessage as the end request handler prm.add_endRequest(displayFadeoutMessage); function displayFadeoutMessage() { //--if there is a message to display then show it if ($("#ctl00_hfSaveMessageText").attr("value") != "") { //--add a span to the placeholder span and then fade it out // over 4.5 seconds $("#mpSaveSpot").append("&lt;span id='spanFadeoutMessage' style='background-color:#ddd;'&gt;" + $("#ctl00_hfSaveMessageText").attr("value") + "&lt;/span&gt;").fadeOut(4500, function() { //--once the message is faded out then clear the message hidden // field and clear out the message span $("#ctl00_hfSaveMessageText").attr("value", ""); $("#mpSaveSpot").empty(); }); } } </code></pre> <p>Now I have a re-usable mechnism for displaying fancy fadeout messages on my site regardless of the page I am on. Problem solved!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload