Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
<small></small>I have a grid with inline edit option. On hitting enter key each row get updated. but while hitting enter key continuously data get duplicating.
so i need to prevent enter key submit from second press on words. Please help me to solve this...
Posted
Updated 19-Nov-15 21:40pm
v2

1 solution

C#
protected void Page_Load(object sender, EventArgs e)
   {

       if (!IsPostBack)
       {
           Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
       }
   }
 protected void Page_PreRender(object sender, EventArgs e)
   {
       ViewState["CheckRefresh"] = Session["CheckRefresh"];
   }

 protected void SubmitClick(object sender, EventArgs e)
 {
     try
     {
         if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
         {
            

             //Your Code For Submit Or Update
 Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());

         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }


Put
Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());

After the code block
 
Share this answer
 
v4
Comments
CSR89 20-Nov-15 3:41am    
its not working..
Arasappan 20-Nov-15 4:05am    
It will definitely wrk

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