mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
* System.Web.UI/AttributeCollection.cs: don't need a Hastable. StateBag now works fine and takes care of the details. * System.Web.UI/Control.cs: added HasChildren property. * System.Web.UI/StateBag.cs: fixed a couple of nasty bugs. * System.Web.UI.HtmlControls/HtmlButton.cs: RenderAttributes is an override, not new. * System.Web.UI.HtmlControls/HtmlContainerControl.cs: use the new Render method in HtmlControl. * System.Web.UI.HtmlControls/HtmlControl.cs: added Render method to render the tag and its attributes. Works for container and non-containers. * System.Web.UI.HtmlControls/HtmlImage.cs: RenderAttributes don't need to be new. Implemented Height property. svn path=/trunk/mcs/; revision=5130
71 lines
1.6 KiB
C#
71 lines
1.6 KiB
C#
/* System.Web.UI.HtmlControls
|
|
* Authors
|
|
* Leen Toelen ([email protected])
|
|
*/
|
|
|
|
using System;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
|
|
namespace System.Web.UI.HtmlControls{
|
|
|
|
public class HtmlButton : HtmlContainerControl, IPostBackEventHandler{
|
|
|
|
private static readonly object EventServerClick;
|
|
|
|
//Checked
|
|
static HtmlButton(){
|
|
EventServerClick = new Object();
|
|
}
|
|
//Checked
|
|
public HtmlButton(): base("button"){}
|
|
|
|
//Checked
|
|
protected virtual void OnServerClick(EventArgs e){
|
|
EventHandler handler;
|
|
handler = (EventHandler) Events[EventServerClick];
|
|
if(handler != null){
|
|
handler.Invoke(this, e);
|
|
}
|
|
}
|
|
|
|
protected override void RenderAttributes(HtmlTextWriter writer){
|
|
if (Page != null && Events[EventServerClick] != null){
|
|
/* Got to figure out how to manage events */
|
|
}
|
|
base.RenderAttributes(writer);
|
|
}
|
|
|
|
void System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(string eventArgument){
|
|
if (CausesValidation){
|
|
Page.Validate();
|
|
}
|
|
OnServerClick(EventArgs.Empty);
|
|
}
|
|
|
|
public event EventHandler ServerClick{
|
|
add{
|
|
Events.AddHandler(EventServerClick, value);
|
|
}
|
|
remove{
|
|
Events.RemoveHandler(EventServerClick, value);
|
|
}
|
|
}
|
|
|
|
public bool CausesValidation{
|
|
get{
|
|
object attr = ViewState["CausesValidation"];
|
|
if (attr != null){
|
|
return (Boolean) attr;
|
|
}
|
|
return true;
|
|
}
|
|
set{
|
|
ViewState["CausesValidation"] = (Boolean) value;
|
|
}
|
|
}
|
|
|
|
} // class HtmlButton
|
|
} // namespace System.Web.UI.HtmlControls
|
|
|