tags:

views:

46

answers:

1

You know how the iDevices will display a different keyboard layout depending on the HTML 5 value of the type attribute? So, <input type="email"... will display the iPad's e-mail keboard layout. I am using a .net TextBox but would like to have the iDevices show the appropriate keyboard layout for the field. But the type attribute gets overridden to "text" when the TextBox control renders. Any ideas?

A: 

No easy fix, but you can create some new control like:

public EnhancedTextBox : TextBox {
     public Html5Type Html5Type { get; set; }

     override AddAttributesToRender(HtmlTextWriter writer) {
           // add attribute according to the selected type in the property
           // something like
           writer.AddAttribute("type", "email");
           base.AddAttributesToRender(writer);
     }
}

and use that instead of a normal TextBox

Jan Jongboom