From 5f611534bf9f4f10d44eaccece7da45aa63a7bb4 Mon Sep 17 00:00:00 2001 From: Greg Edwards Date: Fri, 23 Jan 2015 21:13:53 -0500 Subject: [PATCH] Added LabelTextBox control which renders a textbox with a label contained inside. --- gts/controls/LabelTextBox.ascx | 11 +++++ gts/controls/LabelTextBox.ascx.cs | 53 ++++++++++++++++++++++ gts/controls/LabelTextBox.ascx.designer.cs | 33 ++++++++++++++ gts/css/form.css | 46 +++++++++++++++++++ gts/gts.csproj | 10 ++++ gts/script/form.js | 13 ++++++ 6 files changed, 166 insertions(+) create mode 100644 gts/controls/LabelTextBox.ascx create mode 100644 gts/controls/LabelTextBox.ascx.cs create mode 100644 gts/controls/LabelTextBox.ascx.designer.cs create mode 100644 gts/css/form.css create mode 100644 gts/script/form.js diff --git a/gts/controls/LabelTextBox.ascx b/gts/controls/LabelTextBox.ascx new file mode 100644 index 00000000..0ab9b408 --- /dev/null +++ b/gts/controls/LabelTextBox.ascx @@ -0,0 +1,11 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LabelTextBox.ascx.cs" Inherits="PkmnFoundations.GTS.controls.LabelTextBox" %> +<%@ Register TagPrefix="pf" Namespace="PkmnFoundations.Web" Assembly="PkmnFoundations.GTS" %> + + + + + +
+ + +
diff --git a/gts/controls/LabelTextBox.ascx.cs b/gts/controls/LabelTextBox.ascx.cs new file mode 100644 index 00000000..0e276651 --- /dev/null +++ b/gts/controls/LabelTextBox.ascx.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace PkmnFoundations.GTS.controls +{ + public partial class LabelTextBox : System.Web.UI.UserControl + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + public String Text + { + get + { + return theTextBox.Text; + } + set + { + theTextBox.Text = value; + } + } + + public String Label + { + get + { + return theLabel.Text; + } + set + { + theLabel.Text = value; + } + } + + public TextBoxMode TextMode + { + get + { + return theTextBox.TextMode; + } + set + { + theTextBox.TextMode = value; + } + } + } +} \ No newline at end of file diff --git a/gts/controls/LabelTextBox.ascx.designer.cs b/gts/controls/LabelTextBox.ascx.designer.cs new file mode 100644 index 00000000..b1eafb1a --- /dev/null +++ b/gts/controls/LabelTextBox.ascx.designer.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace PkmnFoundations.GTS.controls { + + + public partial class LabelTextBox { + + /// + /// theLabel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label theLabel; + + /// + /// theTextBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox theTextBox; + } +} diff --git a/gts/css/form.css b/gts/css/form.css new file mode 100644 index 00000000..b2e93d32 --- /dev/null +++ b/gts/css/form.css @@ -0,0 +1,46 @@ +input[type=text], input[type=password], select, textarea +{ + display: block; + border: 1px solid #999999; + background-color: white; + box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1) inset; + width: 200px; + height: 14px; + padding: 2px; + font-size: 10pt; + font-family: Arial,Helvetica,sans-serif; +} + +input[type=text]:focus, input[type=password]:focus, select, textarea:focus, +input[type=text]:focus, input[type=password]:focus, select, textarea:focus +{ + +} + +.pfLabelTextBox +{ + position: relative; + font-family: Arial,Helvetica,sans-serif +} + +.pfLabelTextBox label +{ + display: block; + height: 0; + overflow: visible; + position: relative; + top: 2px; left: 3px; + color: #cccccc; +} + +.pfLabelTextBox input +{ + display: block; + background-color: transparent; + position: relative; +} + +.pfLabelTextBox input:focus, .pfLabelTextBox input.hasContent +{ + background-color: white; +} diff --git a/gts/gts.csproj b/gts/gts.csproj index f02780a1..ffbfd0cd 100644 --- a/gts/gts.csproj +++ b/gts/gts.csproj @@ -79,6 +79,8 @@ + + @@ -3462,6 +3464,7 @@ + @@ -3516,6 +3519,13 @@ Sessions.aspx + + LabelTextBox.ascx + ASPXCodeBehind + + + LabelTextBox.ascx + Default.aspx ASPXCodeBehind diff --git a/gts/script/form.js b/gts/script/form.js new file mode 100644 index 00000000..44b56f46 --- /dev/null +++ b/gts/script/form.js @@ -0,0 +1,13 @@ +function labelTextBox_Change() +{ + if (this.value.length > 0) + $(this).addClass("hasContent"); + else + $(this).removeClass("hasContent"); +} + +$(document).ready(function () +{ + $("input").change(labelTextBox_Change); + $("input").each(labelTextBox_Change); +})