// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System;
using System.ComponentModel;
-using System.Web.UI;
+using System.Security.Permissions;
namespace System.Web.UI.WebControls {
+
+ // CAS
+ [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+ // attributes
[ControlBuilder(typeof(LiteralControlBuilder))]
[DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, " + Consts.AssemblySystem_Design)]
[DefaultProperty("Text")]
#if NET_2_0
[DefaultValue (LiteralMode.Transform)]
- [MonoTODO]
[WebSysDescription ("")]
[WebCategory ("Behavior")]
public LiteralMode Mode
{
get {
- throw new NotImplementedException ();
+ return ViewState ["Mode"] == null ? LiteralMode.Transform : (LiteralMode) ViewState ["Mode"];
}
set {
- throw new NotImplementedException ();
+ if (((int) value) < 0 || ((int) value) > 2)
+ throw new ArgumentOutOfRangeException ();
+ ViewState ["Mode"] = value;
}
}
#endif
[WebCategory ("Appearance")]
#if NET_2_0
[Localizable (true)]
- public virtual
-#else
- public
#endif
- string Text {
+ public string Text {
get {
return ViewState.GetString ("Text", String.Empty);
}
#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Never)]
- [MonoTODO]
public override void Focus ()
{
- throw new NotImplementedException ();
+ throw new NotSupportedException ();
}
#endif
-#if NET_2_0
- [EditorBrowsable (EditorBrowsableState.Never)]
-#endif
protected override ControlCollection CreateControlCollection ()
{
return new EmptyControlCollection (this);
}
- [MonoTODO ("I can't find a type that it can have children of")]
protected override void AddParsedSubObject (object obj)
{
+ LiteralControl literal = obj as LiteralControl;
+ if (literal != null) {
+ Text = literal.Text;
+ return;
+ }
+
throw new HttpException (Locale.GetText (
"'Literal' cannot have children of type '{0}'",
obj.GetType ()));
#endif
override void Render (HtmlTextWriter output)
{
+#if NET_2_0
+ if (Mode == LiteralMode.Encode)
+ output.Write (HttpUtility.HtmlEncode (Text));
+ else
+#endif
output.Write (Text);
}
}