mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
Adding reference source for System.Data System.Data.DataSetExtensions System.Data.Entity System.Data.Entity.Design System.Data.Linq System.Data.SqlXml System.ServiceModel System.ServiceModel.Activation System.ServiceModel.Activities System.ServiceModel.Channels System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.WasHosting System.ServiceModel.Web System.Web System.Web.ApplicationServices System.Web.DynamicData System.Web.Entity System.Web.Entity.Design System.Web.Extensions System.Web.Mobile System.Web.Routing System.Web.Services System.Xml System.Xml.Linq
104 lines
3.5 KiB
C#
104 lines
3.5 KiB
C#
//------------------------------------------------------------------------------
|
|
// <copyright file="HtmlInputGenericControl.cs" company="Microsoft">
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// </copyright>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace System.Web.UI.HtmlControls {
|
|
using System;
|
|
using System.Collections.Specialized;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
|
|
/// <devdoc>
|
|
/// <para>
|
|
/// The <see langword='HtmlInputGenericControl'/>
|
|
/// class defines the methods, properties, and events for the a generic input
|
|
/// control. This class allows programmatic access to the HTML5 <input>
|
|
/// elements on the server.
|
|
/// </para>
|
|
/// </devdoc>
|
|
[
|
|
DefaultEvent("ServerChange"),
|
|
ValidationProperty("Value"),
|
|
]
|
|
public class HtmlInputGenericControl : HtmlInputControl, IPostBackDataHandler {
|
|
private static readonly object EventServerChange = new object();
|
|
|
|
/// <summary>
|
|
/// Creates an intrinsic Html INPUT type=text control.
|
|
/// </summary>
|
|
public HtmlInputGenericControl() : base("text") {
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates an intrinsic Html INPUT control based on its type.
|
|
/// </summary>
|
|
/// <param name="type">The type of the control</param>
|
|
public HtmlInputGenericControl(string type)
|
|
: base(type) {
|
|
}
|
|
|
|
[
|
|
WebCategory("Action"),
|
|
WebSysDescription(SR.HtmlInputText_ServerChange)
|
|
]
|
|
public event EventHandler ServerChange {
|
|
add {
|
|
Events.AddHandler(EventServerChange, value);
|
|
}
|
|
remove {
|
|
Events.RemoveHandler(EventServerChange, value);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Method used to raise the OnServerChange event.
|
|
/// </summary>
|
|
/// <param name="e">Event</param>
|
|
protected virtual void OnServerChange(EventArgs e) {
|
|
EventHandler handler = (EventHandler)Events[EventServerChange];
|
|
if (handler != null) {
|
|
handler(this, e);
|
|
}
|
|
}
|
|
|
|
protected internal override void OnPreRender(EventArgs e) {
|
|
base.OnPreRender(e);
|
|
|
|
if (!Disabled && Page != null) {
|
|
Page.RegisterEnabledControl(this);
|
|
}
|
|
}
|
|
|
|
bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection) {
|
|
return LoadPostData(postDataKey, postCollection);
|
|
}
|
|
|
|
protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection) {
|
|
string current = Value;
|
|
string inputString = postCollection.GetValues(postDataKey)[0];
|
|
|
|
if (!current.Equals(inputString)) {
|
|
ValidateEvent(postDataKey);
|
|
|
|
Value = inputString;
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void IPostBackDataHandler.RaisePostDataChangedEvent() {
|
|
RaisePostDataChangedEvent();
|
|
}
|
|
|
|
[SuppressMessage("Microsoft.Design", "CA1030:UseEventsWhereAppropriate", Justification = @"Events are being used correctly for RaisePostBackEvent and RaisePostDataChangedEvent.")]
|
|
protected virtual void RaisePostDataChangedEvent() {
|
|
OnServerChange(EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|