mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -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
74 lines
1.2 KiB
C#
Executable File
74 lines
1.2 KiB
C#
Executable File
//
|
|
// System.Web.UI.AttributeCollection.cs
|
|
//
|
|
// Duncan Mak ([email protected])
|
|
//
|
|
// (C) Ximian, Inc.
|
|
//
|
|
|
|
using System;
|
|
using System.Collections;
|
|
|
|
namespace System.Web.UI {
|
|
|
|
public sealed class AttributeCollection
|
|
{
|
|
private StateBag bag;
|
|
|
|
public AttributeCollection (StateBag bag)
|
|
{
|
|
this.bag = bag;
|
|
}
|
|
|
|
public int Count {
|
|
get { return bag.Count; }
|
|
}
|
|
|
|
[MonoTODO]
|
|
public CssStyleCollection CssStyle {
|
|
get { return null; }
|
|
}
|
|
|
|
public string this [string key] {
|
|
get { return bag [key] as string; }
|
|
|
|
set { bag.Add (key, value); }
|
|
}
|
|
|
|
public ICollection Keys {
|
|
get { return bag.Keys; }
|
|
}
|
|
|
|
public void Add (string key, string value)
|
|
{
|
|
bag.Add (key, value); // if exists, only the value is replaced.
|
|
}
|
|
|
|
public void AddAttributes (HtmlTextWriter writer)
|
|
{
|
|
foreach (string key in bag.Keys) {
|
|
string value = bag [key] as string;
|
|
writer.AddAttribute (key, value);
|
|
}
|
|
}
|
|
|
|
public void Clear ()
|
|
{
|
|
bag.Clear ();
|
|
}
|
|
|
|
public void Remove (string key)
|
|
{
|
|
bag.Remove (key);
|
|
}
|
|
|
|
public void Render (HtmlTextWriter writer)
|
|
{
|
|
foreach (string key in bag.Keys) {
|
|
string value = bag [key] as string;
|
|
writer.WriteAttribute (key, value);
|
|
}
|
|
}
|
|
}
|
|
}
|