C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




On Before Unload


Posted Date: 28 Aug 2008    Resource Type: Code Snippets    Category: ASP.NET WebForms

Posted By: saravanan       Member Level: Gold
Rating:     Points: 5



The following code for Raising the Event, when we close a page on a browser. Just create a temp page for updating the values to Database. For example if we have a normal page as sample.aspx. But we need the affect the Database while we close that page. For that we create a Dummy page as Default.aspx. In that page write the code for database updation. Just raise the event of "onbeforeunload" in main page(sample.aspx), for that event we call handleonclose() function in javascript. In that script we calling the dummy page(default.aspx). Then we can update the Database easily. But only one problem is whenever you refreshes the page, the event will fired. This may be used in POP UP windows.






onunload="HandleOnClose()">








Attachments

  • onbeforeunload (20547-28431-onbeforeunload.txt)



  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Page Unload event  .  Onbeforeunload  .  Javascript  .  Code  .  ASP.NET  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Validate username and Password using Login Control and SQL
    Previous Resource: Vb.net code to display images and titles of Searched sale items by Price
    Return to Discussion Resource Index
    Post New Resource
    Category: ASP.NET WebForms


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design

    web conferencing

    Contact Us    Privacy Policy    Terms Of Use