Added a "Type" property to form inputs.

Fixed the second "title" section found in web page heads.
This commit is contained in:
Paul Schneider
2014-10-01 15:34:00 +02:00
parent 71f1cfcf20
commit 301dbdcb6d
15 changed files with 83 additions and 24 deletions

View File

@ -7,12 +7,23 @@ namespace SalesCatalog.Model
public CheckBox ()
{
}
#region implemented abstract members of FormInput
public override string Type {
get {
return "checkbox";
}
}
public bool Value { get; set; }
public override string ToHtml ()
{
return string.Format ("<input type=\"checkbox\" id=\"{0}\" name=\"{1}\" {2}/>", Id,Name,Value?"checked":"");
}
#endregion
}
}

View File

@ -4,6 +4,13 @@ namespace SalesCatalog.Model
{
public class FilesInput : FormInput
{
#region implemented abstract members of FormInput
public override string Type {
get {
return "file";
}
}
#endregion
public FilesInput ()
{

View File

@ -13,6 +13,7 @@ namespace SalesCatalog.Model
public string Id { get; set; }
private string name=null;
public abstract string Type { get; }
public string Name { get { return name == null ? Id : name; } set { name = value; } }
}
}

View File

@ -4,6 +4,16 @@ namespace SalesCatalog.Model
{
public class RadioButton:FormInput
{
#region implemented abstract members of FormInput
public override string Type {
get {
return "radio";
}
}
#endregion
public RadioButton ()
{
}

View File

@ -6,6 +6,16 @@ namespace SalesCatalog.Model
{
public class SelectInput: FormInput
{
#region implemented abstract members of FormInput
public override string Type {
get {
return "select";
}
}
#endregion
public Option[] Items;
public int SelectedIndex;
public override string ToHtml ()

View File

@ -4,9 +4,18 @@ namespace SalesCatalog.Model
{
public class TextInput:FormInput
{
#region implemented abstract members of FormInput
public override string Type {
get {
return "text";
}
}
#endregion
public TextInput ()
{
}
public TextInput (string txt)
{
text = txt;