How to get enter key to submit data while avoiding validation summary problem.
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// Add new attribute to form1 event to fire when enter key submit button click event
form1.Attributes.Add("onkeydown", "javascript: return WebForm_FireDefaultButton (event, '" + ButtonName.ClientID + "')");
// Allow you to use enter key for sumbit data
ClientScript.RegisterHiddenField("__EVENTTARGET", "ButtonName");
}
}
// Then add this Page_Load event to div section on the form1
div id="inputArea" onkeypress="javascript:return WebForm_FireDefaultButton(event,'ButtonName')"
Hope this helps,
Cheers :)
Cheers :)
0 comments:
Post a Comment