Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Actually I have two button clicks:-

C#
protected void Button4_Click1(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        if (CheckBox1.Checked == true)
            bindgrid();

    }

    protected void Button5_Click(object sender, EventArgs e)
    {

        if (CheckBox2.Checked == true)
            busbindgrid();
    }



Now I am getting problem on page refresh, page load.

Although I find this somewhere on net , but it's still not working:-

C#
Boolean IsPageRefresh;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["postids"] = System.Guid.NewGuid().ToString();
            Session["postid"] = ViewState["postids"].ToString();
        }
        else
        {
            if (ViewState["postids"].ToString() != Session["postid"].ToString())
            {
                IsPageRefresh = true;
            }
            Session["postid"] = System.Guid.NewGuid().ToString();
            ViewState["postids"] = Session["postid"].ToString();
        }
    }



Am I doing something wrong?? Please HELP!!
Posted
Comments
Deepak Kanswal Sharma 22-Jun-15 1:29am    
Although with the above code. The values are getting saved in sql whenever F5 is hit or page is refreshed.

1 solution

 
Share this answer
 
Comments
Deepak Kanswal Sharma 22-Jun-15 22:32pm    
Yeah, I already tried that code but it's not working.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900