i have three gridview in one page say form1.aspx.Initially when the page is loading only first two gridview should appear.When i click any of the hyperlink in the first two gridview it will navigate to another page say form2.aspx which has a button . If i click on this button it will navigate to the previous page. Only at this point of time my third gridview should be visible.Please be clear in your answer as i am new to .net

In the page load event of form1.aspx i will make

in the button click event of form2.aspx i will redirect the page as
At this point of time the third gridview in form1 should be visible.
At which part of code in form1.aspx i should make the gridview visibility true?


Have you tried using a session variable?

This is a trick I use often to tell what page I am navigating from.

To do this I do:

HttpContext.Current.Session["PreviousPage"] = "form2";

and then on form 1, do something like,

if(HttpContext.Current.Session["PreviousPage"] != null && HttpContext.Current.Session["PreviousPage"] == "form2")
    Gridview2.visible = true;
    Gridview2.visible = false;

HttpContext.Current.Session["PreviousPage"] = null;

Make sure to clear the value in the session variable when you no longer need it or it may cause a problem if you try to use it again.

Hope that helps.