Files
mono/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlInputButton.cs
T
Gonzalo Paniagua Javier 2a93e6a46e 2002-07-17 Gonzalo Paniagua Javier <[email protected]>
* HtmlAnchor.cs:
	* HtmlButton.cs:
	* HtmlInputButton.cs:
	* HtmlInputCheckBox.cs:
	* HtmlInputHidden.cs:
	* HtmlInputImage.cs:
	* HtmlInputText.cs:
	* HtmlTextArea.cs: Initialize EventHandlerList indexer.

	* HtmlContainerControl.cs: almost rewritten to use a LiteralControl
	instead of maintaining some flags and strings. Implemented
	LoadViewState.

	* HtmlControl.cs: fixed constructor and added ViewStateIgnoreCase.

	* HtmlSelect.cs: fixed TrackViewState, SaveViewState, SelectedIndices
	and Value.

svn path=/trunk/mcs/; revision=5864
2002-07-17 16:08:01 +00:00

75 lines
1.6 KiB
C#
Executable File

/* System.Web.UI.HtmlControls
* Authors
* Leen Toelen ([email protected])
*/
using System;
using System.ComponentModel;
using System.Globalization;
using System.Web;
using System.Web.UI;
namespace System.Web.UI.HtmlControls{
[DefaultEvent("ServerClick")]
public class HtmlInputButton : HtmlInputControl, IPostBackEventHandler{
private static readonly object EventServerClick = new object ();
public HtmlInputButton(): base ("button")
{
}
public HtmlInputButton(string type): base(type){}
protected override void OnPreRender (EventArgs e)
{
base.OnPreRender(e);
}
protected override void RenderAttributes (HtmlTextWriter writer)
{
base.RenderAttributes (writer);
}
protected virtual void OnServerClick(EventArgs e){
EventHandler handler = (EventHandler) Events[EventServerClick];
if (handler != null){
handler.Invoke(this, e);
}
}
void IPostBackEventHandler.RaisePostBackEvent (string eventArgument)
{
if(CausesValidation == true){
Page.Validate();
}
OnServerClick(EventArgs.Empty);
}
public event EventHandler ServerClick{
add{
Events.AddHandler(EventServerClick, value);
}
remove{
Events.RemoveHandler(EventServerClick, value);
}
}
public bool CausesValidation{
get{
object causesVal = ViewState["CausesValidation"];
if (causesVal != null){
return (Boolean) causesVal;
}
return true;
}
set{
ViewState["CausesValidation"] = (Boolean) value;
}
}
} // end of System.Web.UI.HtmlControls.HtmlInputButton
} // namespace System.Web.UI.HtmlControls