Thursday, September 27, 2012

Show Successfull Message Using Jquery in asp.net



.aspx
<script type="text/javascript">
function ShowErrorMessage() {
$(document).ready(function () {
$(".ErrorMsgContainer").stop(true, true).show("slide", { direction: "up", opacity: 0.4 }, 0);
setTimeout(function () {
$(".ErrorMsgContainer").stop(true, true).hide("slide", { direction: "up", opacity: 0.4 }, 500);
  }, 10000);
 });
}
function HideErrorMessage() {
   $(document).ready(function () {
  $(".ErrorMsgContainer").stop(true, true).hide();
 });
}
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest);
  function EndRequest(sender, args) {
    HideErrorMessage();
    ShowErrorMessage();                
  }
</script>
<style>
.ErrorMsgContainer
{
 position: fixed;             
 display: none;
 background-color: Yellow;
 border: 1px solid;
 padding: 5px;
 padding-left: 30px;
 padding-right: 30px;
 color: #fff;
 font-size: 12px;
}
</style>
<div class="ErrorMsgContainer">
    <asp:Literal ID="ltrErrorMsg" runat="server"></asp:Literal>
</div>
.aspx.CS
HideErrorMessage(ltrErrorMsg, string.Empty);
ShowErrorMessage(ltrErrorMsg, "Data Saved Successfully");

No comments:

Post a Comment

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software