CTextBox.MarkInvalid

This commit is contained in:
2015-06-04 00:19:42 +02:00
parent 5933bd8afc
commit f314044521
2 changed files with 18 additions and 6 deletions

View File

@@ -18,6 +18,8 @@ namespace Scrummer.Code.Controls
private string _placeHolder = string.Empty;
private bool _markedInvalid = false;
#endregion
#region Properties
@@ -39,7 +41,13 @@ namespace Scrummer.Code.Controls
get { return _placeHolder; }
set { _placeHolder = value; }
}
public bool MarkedInvalid
{
get { return _markedInvalid; }
set { _markedInvalid = value; }
}
#endregion
#region Control life cycle
@@ -56,11 +64,11 @@ namespace Scrummer.Code.Controls
{
CssClass = String.Format("{0} {1}", CssClassBase, _cssClassExtra);
}
if (Page.IsPostBack && _allowEmpty == false && IsEmpty())
if (Page.IsPostBack && (_allowEmpty == false && IsEmpty()) || _markedInvalid)
{
CssClass += " textboxEmpty";
CssClass += " textboxInvalid";
}
Attributes.Add("onchange", "ElementRemoveClass(this, 'textboxEmpty');");
Attributes.Add("onchange", "ElementRemoveClass(this, 'textboxInvalid');");
if (string.IsNullOrEmpty(_placeHolder) == false)
{

View File

@@ -109,11 +109,11 @@ h3 {
border: solid 1px black;
box-shadow: 0px 0px 10px rgba(255,255,255,0.5), inset 0px -2px 5px rgba(255,255,255,1), inset 0px 2px 5px rgba(0,0,0,0.5);
}
.textboxEmpty{
.textboxInvalid{
box-shadow: 0px 0px 10px rgba(255,0,0,0.5), inset 0px -2px 5px rgba(255,255,255,1), inset 0px 2px 5px rgba(0,0,0,0.5);
border: solid 1px rgb(255,0,0);
}
.textboxEmpty:focus{
.textboxInvalid:focus{
box-shadow: 0px 0px 10px rgba(255,0,0,0.5), inset 0px -2px 5px rgba(255,255,255,1), inset 0px 2px 5px rgba(0,0,0,0.5);
border: solid 1px black;
}
@@ -131,6 +131,10 @@ h3 {
text-align: center;
cursor: pointer;
background-color: rgb(192,192,192);
margin-left: 5px;
}
.button:first-child{
margin-left: 0;
}
.button:hover{
background-color: rgb(220,220,220);