Hello Everyone,
Suppose I had Inserted one record, Now, when I refresh Page same record is inserted again though I had cleared all the textboxes after insertion. How can i avoid this???For This you to put the following code
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString());
}
}
protected void btnSubmit_PreRender(object sender, EventArgs e)
{
ViewState["update"] = Session["update"];
}
protected void btnSubmit_Click(object sender, ImageClickEventArgs e)
{
if (Session["update"].ToString() == ViewState["update"].ToString())
{
Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString());
//Write your Insert Code.
}
}
Sanjeev Kumar