protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Insert", StringComparison.OrdinalIgnoreCase)) { TextBox txt_emp_id = ((TextBox)GridView1.FooterRow.FindControl("txt_emp_id")); string emp_id = txt_emp_id.Text; } }
txt_emp_first_name.Attributes.Add("onkeydown","return (event.keyCode!=13);"); //OR txt_emp_first_name.Attributes.Add("onkeydown","prevent_submission();");
<body onkeydown = "return (event.keyCode!=13);">