dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online Memberstarunkumar
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » ASP.NET »

How to prevent showing alert messages when page is refreshing or reloading?


Posted Date: 16 Jul 2012      Posted By:: GiRi $     Member Level: Silver    Member Rank: 362     Points: 3   Responses: 3



In my web page having edit and cancel button .if we click edit button means it provide already user information to update,after finish the edit operation it shows the alert message that updated successfull..if i click refresh f5 continuously means again it show the alert message.how do prevent this????



Responses

#680588    Author: Ajatshatru Upadhyay      Member Level: Gold      Member Rank: 20     Date: 16/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

Hi,

It seems that you put the alert message statement in page load. Put the code in button click event.
If this is not the case, please provide some more detail with code.

Hope it'll help you.
Regards
Ajatshatru



 
#680620    Author: Anil Kumar Pandey      Member Level: Platinum      Member Rank: 1     Date: 17/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

Please put the alert message binding in the ASPX page level only.

if at all you are using it with the code behind then put the code under the !PAGE.ISPOSTBACK()

Thanks & Regards
Anil Kumar Pandey
Microsoft MVP, DNS MVM



 
#680983    Author: GiRi $      Member Level: Silver      Member Rank: 362     Date: 19/Jul/2012   Rating: 2 out of 52 out of 5     Points: 1

<asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Button" />




protected void Page_PreRender(object sender, EventArgs e)

{

ViewState["IsPageRefreshed"] = Session["IsPageRefreshed"];

}



protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

Session["IsPageRefreshed"] = Server.UrlDecode(System.DateTime.Now.ToString());

}

}

protected void btnSave_Click(object sender, EventArgs e)

{

if (Session["IsPageRefreshed"].ToString() == ViewState["IsPageRefreshed"].ToString())

{

Session["IsPageRefreshed"] = Server.UrlDecode(System.DateTime.Now.ToString());

ScriptManager.RegisterClientScriptBlock(this, this.Page.GetType(), "abc", "alert('Button clicked')", true);

}

}



this is the answer






 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Create failed for Database in iis7. How to Solve? URGENT
Previous : Dataset related query
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.