Files
mono/mcs/class/System.Web/System.Web.UI.WebControls/Image.cs
T
Gonzalo Paniagua Javier b79e2220a3 2002-06-11 Gonzalo Paniagua Javier <[email protected]>
* System.Web.Caching/CacheDependency.cs: fixed a couple of typos and
	don't throw NotImplementedException in constructors.

	* System.Web.UI/Control.cs:
	(MapPathSecure): until security is implemented, return the same path
	received as argument.
	(RenderControl): call OnPreRender before rendering the control. So
	AdRotator can read its configuration file.Is there any other place
	where this should be done?

	* System.Web.UI/HtmlTextWriter.cs:
	(AddAttribute): fixed. Now it really stores attributes.
	(RenderBeginTag): fixed a couple of bugs (little ones but hard to find).

	* System.Web.UI.WebControls/AdRotator.cs: GetData does not work as it
	should, but now it returns useful data (only the first ad in the file).
	Set the NavigateUrl property in the hyperlink if available.

	* System.Web.UI.WebControls/HyperLink.cs: fixed constructor and a
	couple of stack overflows.

	* System.Web.UI.WebControls/Image.cs: added an attribute and fixed
	stack overflow.

	* System.Web.UI.WebControls/WebControl.cs:
	(RenderBeginTag): fixed.
	(TagName): don't call Enum.IsDefined twice.

svn path=/trunk/mcs/; revision=5230
2002-06-11 19:37:03 +00:00

120 lines
2.2 KiB
C#

/**
* Namespace: System.Web.UI.WebControls
* Class: Image
*
* Author: Gaurav Vaish
* Maintainer: [email protected]
* Contact: <[email protected]>, <[email protected]>
* Implementation: yes
* Status: 100%
*
* (C) Gaurav Vaish (2001)
*/
using System;
using System.Web;
using System.Web.UI;
using System.ComponentModel;
namespace System.Web.UI.WebControls
{
[DefaultProperty("ImageUrl")]
[ParseChildrenAttribute(false)]
public class Image : WebControl
{
public Image(): base(HtmlTextWriterTag.Img)
{
}
public virtual string AlternateText
{
get
{
object o = ViewState["AlternateText"];
if(o!=null)
return (string)o;
return String.Empty;
}
set
{
ViewState["AlternateText"] = value;
}
}
public override bool Enabled
{
get
{
return base.Enabled;
}
set
{
base.Enabled = value;
}
}
public override FontInfo Font
{
get
{
return base.Font;
}
}
public virtual ImageAlign ImageAlign
{
get
{
object o = ViewState["ImageAlign"];
if(o!=null)
return (ImageAlign)o;
return ImageAlign.NotSet;
}
set
{
ViewState["ImageAlign"] = value;
}
}
public virtual string ImageUrl
{
get
{
object o = ViewState["ImageUrl"];
if(o!=null)
return (string)o;
return String.Empty;
}
set
{
ViewState["ImageUrl"] = value;
}
}
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
if(ImageUrl.Length > 0)
{
writer.AddAttribute(HtmlTextWriterAttribute.Src, ResolveUrl(ImageUrl));
}
if(AlternateText.Length > 0)
{
writer.AddAttribute(HtmlTextWriterAttribute.Alt, AlternateText);
}
if(BorderWidth.IsEmpty)
{
writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
}
if(ImageAlign != ImageAlign.NotSet)
{
writer.AddAttribute(HtmlTextWriterAttribute.Align, Enum.Format(typeof(ImageAlign), ImageAlign, "G"));
}
}
protected override void RenderContents(HtmlTextWriter writer)
{
}
}
}