Eventuell so?
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace test
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:MyButton runat=server></{0}:MyButton>")]
public class MyButton : WebControl
{
//Used by toggleImage
private string imageUrlExpanded;
private string imageUrlCollapsed;
//The image
private Image image = new Image();
//Defines which image to display
private bool expanded = true;
[Bindable(true),
Category("Appearance"),
DefaultValue(true)]
public bool Expanded
{
get
{
return this.expanded;
}
set
{
this.expanded = value;
}
}
[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string ImageUrlExpanded
{
get
{
return this.imageUrlExpanded;
}
set
{
this.imageUrlExpanded = value;
}
}
[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string ImageUrlCollapsed
{
get
{
return this.imageUrlCollapsed;
}
set
{
this.imageUrlCollapsed = value;
}
}
protected override void CreateChildControls()
{
this.image.ImageUrl = (this.expanded) ?
this.imageUrlExpanded : this.imageUrlCollapsed;
this.Controls.Add(image);
}
}
}
_______________________________________________
Asp.net Mailingliste, Postings senden an:
[email protected]
An-/Abmeldung und Suchfunktion unter:
http://www.glengamoi.com/mailman/listinfo/asp.net