Detecting Refresh or Postback in ASP.NET

One of the biggest challenges for web developers is the resubmission of form data or the refresh of a form to post information to a database. This happens when the user, for whatever reason, resubmits or refreshes the form, which has the potential to cause chaos with duplicated database insertions or repeated email submissions.
In this article I Will show you how to define page is postback or refresh after postback.
Here my simple code

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Session["PostID"] = "1001";
            ViewState["PostID"] = Session["PostID"].ToString();
            Response.Write("First Load");
        }
        else
        {
            if (ViewState["PostID"].ToString() == Session["PostID"].ToString())
            {
                
                Session["PostID"] = (Convert.ToInt16(Session["PostID"]) + 1).ToString();

                ViewState["PostID"] = Session["PostID"].ToString();
                Response.Write("Postback");

            }
            else
            {
                ViewState["PostID"] = Session["PostID"].ToString();
                Response.Write("refreshed");

            }
        }
    }

Thanks

jQuery Tutorial Part 1

This article contains visual tutorials intended for web designers and newbies on how to apply Javascript effects with jQuery.

In case you don’t know about jQuery, it is a “write less, do more” Javascript library.

How jQuery works?
First you need to download a copy of jQuery and insert it in your html page (preferably within the tag). Then you need to write functions to tell jQuery what to do. The diagram below explains the detail how jQuery work:

Simple slide panel

Let’s start by doing a simple slide panel. You’ve probably seen a lot of this, where you click on a link and a panel slide up/down. (view demo)

When an elment with is clicked, it will slideToggle (up/down) the element and then toggle a CSS to the element. The active class will toggle the background position of the arrow image (by CSS).


$(document).ready(function(){
$(".btn-slide").click(function(){
$("#panel").slideToggle("slow");
$(this).toggleClass("active");
});
});

Thanks.