TextBox Demo
Simple textbox:
Numeric textbox:
Numeric with decimals:
Decimals and custom format:
Simple with custom format:
Duration:
Simple textbox:<br />
<% Name.TextBox()
.Placeholder("type here..."); %>
<awe:Ocon runat="server" ID="Name" />
<br />
<br />
Numeric textbox:<br />
<% Numeric.TextBox().Numeric().Value(123); %>
<awe:Ocon runat="server" ID="Numeric" />
<br />
<br />
Numeric with decimals:<br />
<% NumericDec.TextBox().Numeric(o => o.Decimals()).Value(1.2); %>
<awe:Ocon runat="server" ID="NumericDec" />
<br />
<br />
Decimals and custom format:<br />
<% Number.TextBox()
.Value(11.23)
.FormatFunc("aweUtils.postfix('GBP')")
.Numeric(o => o.Decimals(2).Step(0.01)); %>
<awe:Ocon runat="server" ID="Number" />
<br />
<br />
<% Percent.TextBox()
.Value(0.1)
.FormatFunc("aweUtils.percent")
.Numeric(o => o.Decimals(2).Step(0.01).Max(1)); %>
<awe:Ocon runat="server" ID="Percent" />
<br />
<br />
<% PriceUSD.TextBox()
.Value(20)
.FormatFunc("aweUtils.prefix('$')")
.Numeric(o => o.Decimals(2)); %>
<awe:Ocon runat="server" ID="PriceUSD" />
<br />
<br />
Simple with custom format:<br />
<% Exp.TextBox()
.Value("the actual value")
.FormatFunc("secret"); %>
<awe:Ocon runat="server" ID="Exp" />
<br/>
<br/>
Duration:<br/>
<% Duration.TextBox()
.Numeric(o => o.Step(10))
.Value(90)
.FormatFunc("duration('hour', 'hours', 'min')"); %>
<awe:Ocon runat="server" ID="Duration" />
<script>
function secret(val) {
return "secret";
}
function duration(hourw, hoursw, minw) {
return function (val) {
var mval = parseInt(val, 10);
if (isNaN(mval)) return val;
var hour = Math.floor(mval / 60);
var minute = mval % 60;
var res = "";
if (hour > 0) {
res += hour + " " + (hour > 1 ? hoursw : hourw);
}
if (minute > 0) {
res += " " + minute + " " + minw;
}
return res;
};
};
</script>
Comments