CTextBox.NextFocusOnEnter: Point to the next control to focus on Enter key.

This commit is contained in:
2015-09-27 19:39:14 +02:00
parent a7c8a698f2
commit 4762207e2d
4 changed files with 23 additions and 17 deletions

View File

@@ -17,6 +17,8 @@ namespace VAR.Focus.Web.Controls
private bool _markedInvalid = false;
private Control _nextFocusOnEnter = null;
#endregion
#region Properties
@@ -45,6 +47,12 @@ namespace VAR.Focus.Web.Controls
set { _markedInvalid = value; }
}
public Control NextFocusOnEnter
{
get { return _nextFocusOnEnter; }
set { _nextFocusOnEnter = value; }
}
#endregion
#region Control life cycle
@@ -72,6 +80,14 @@ namespace VAR.Focus.Web.Controls
Attributes.Add("placeholder", _placeHolder);
}
if (_nextFocusOnEnter!=null)
{
this.Attributes.Add("onkeydown", String.Format(
"if(event.keyCode==13){{document.getElementById('{0}').focus(); return false;}}",
_nextFocusOnEnter.ClientID));
}
// FIX: The framework deletes textbox values on password mode
if (TextMode == TextBoxMode.Password)
{