// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Collections;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
#endif
{
string render_type;
+ AttributeCollection common_attrs;
#if NET_2_0
AttributeCollection inputAttributes;
[DefaultValue ("")]
[WebSysDescription ("")]
[WebCategoryAttribute ("Behavior")]
- public string ValidationGroup
+ public virtual string ValidationGroup
{
get { return ViewState.GetString ("ValidationGroup", String.Empty); }
set { ViewState["ValidationGroup"] = value; }
}
}
+ static bool IsInputOrCommonAttr (string attname)
+ {
+ attname = attname.ToUpper (CultureInfo.InvariantCulture);
+ switch (attname) {
+ case "VALUE":
+ case "CHECKED":
+ case "SIZE":
+ case "MAXLENGTH":
+ case "SRC":
+ case "ALT":
+ case "USEMAP":
+ case "DISABLED":
+ case "READONLY":
+ case "ACCEPT":
+ case "ACCESSKEY":
+ case "TABINDEX":
+ case "ONFOCUS":
+ case "ONBLUR":
+ case "ONSELECT":
+ case "ONCHANGE":
+ case "ONCLICK":
+ case "ONDBLCLICK":
+ case "ONMOUSEDOWN":
+ case "ONMOUSEUP":
+ case "ONMOUSEOVER":
+ case "ONMOUSEMOVE":
+ case "ONMOUSEOUT":
+ case "ONKEYPRESS":
+ case "ONKEYDOWN":
+ case "ONKEYUP":
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ void AddAttributesForSpan (HtmlTextWriter writer)
+ {
+ ICollection k = Attributes.Keys;
+ string [] keys = new string [k.Count];
+ k.CopyTo (keys, 0);
+ foreach (string key in keys) {
+ if (!IsInputOrCommonAttr (key))
+ continue;
+ if (common_attrs == null)
+ common_attrs = new AttributeCollection (new StateBag ());
+ common_attrs [key] = Attributes [key];
+ Attributes.Remove (key);
+ }
+ Attributes.AddAttributes (writer);
+ }
#if NET_2_0
protected internal
#else
}
if (Attributes.Count > 0){
+ AddAttributesForSpan (w);
Attributes.AddAttributes (w);
need_span = true;
}
w.AddAttribute (HtmlTextWriterAttribute.Tabindex,
TabIndex.ToString (CultureInfo.InvariantCulture));
+ if (common_attrs != null)
+ common_attrs.AddAttributes (w);
w.RenderBeginTag (HtmlTextWriterTag.Input);
w.RenderEndTag ();
string text = Text;
w.AddAttribute (HtmlTextWriterAttribute.Tabindex,
TabIndex.ToString (NumberFormatInfo.InvariantInfo));
+ if (common_attrs != null)
+ common_attrs.AddAttributes (w);
w.RenderBeginTag (HtmlTextWriterTag.Input);
w.RenderEndTag ();
}
#endif
bool LoadPostData (string postDataKey, NameValueCollection postCollection)
{
+ if (!Enabled)
+ return false;
+
string postedValue = postCollection[postDataKey];
bool postedBool = ((postedValue != null) &&
(postedValue.Length > 0));