F
Flare
Hi.
I have now used ASP.NET for a couple of weeks and it _really_ looks good.
I have made a custom control, wich has to act as my header on every site.
Before i go any further with my control I would appreciate your comments on
the design (wich problably is bad) Sorry for the long post...
Eg. is the RenderBeginTag and the RenderEndTag() approch ok?
[DefaultProperty("Text"),
{
private string displayedUserName = "Unknown";
private string headerText;
[Bindable(true),Category("Appearance"), DefaultValue("unknown")]
public string DisplayedUserName
{
get { return displayedUserName; }
set { displayedUserName = value; }
}
Style _style = new Style();
[Bindable(true),Category("Farver"), DefaultValue("")]
public Style LabelStyle
{
get { return _style; }
}
[Bindable(true),Category("Farver"), DefaultValue("")]
public Color ForeColor
{
get { return _style.ForeColor; }
set { _style.ForeColor = value; }
}
protected override void Render(HtmlTextWriter html)
{
_style.AddAttributesToRender( html );
html.AddAttribute("id","TableHeader");
html.AddAttribute("width","100%");
html.AddAttribute("class","test");
html.RenderBeginTag("table");
html.RenderBeginTag("TR");
html.RenderBeginTag("TD");
html.Write(headerText);
html.RenderEndTag();
html.RenderBeginTag("TD");
html.RenderEndTag();
html.RenderEndTag();
html.RenderBeginTag("TR");
html.RenderBeginTag("TD");
html.RenderEndTag();
html.RenderBeginTag("TD");
html.Write("Bruger: ");
html.Write(displayedUserName);
html.RenderEndTag();
html.RenderEndTag();
}
}
(xpostet in microsoft.public.dotnet.framework.aspnet.buildingcontrols,
microsoft.public.dotnet.framework.aspnet.webcontrols)
Regards
Anders
I have now used ASP.NET for a couple of weeks and it _really_ looks good.
I have made a custom control, wich has to act as my header on every site.
Before i go any further with my control I would appreciate your comments on
the design (wich problably is bad) Sorry for the long post...
Eg. is the RenderBeginTag and the RenderEndTag() approch ok?
[DefaultProperty("Text"),
public class ShowHeaderControl : System.Web.UI.WebControls.WebControlToolboxData( said:
{
private string displayedUserName = "Unknown";
private string headerText;
[Bindable(true),Category("Appearance"), DefaultValue("unknown")]
public string DisplayedUserName
{
get { return displayedUserName; }
set { displayedUserName = value; }
}
Style _style = new Style();
[Bindable(true),Category("Farver"), DefaultValue("")]
public Style LabelStyle
{
get { return _style; }
}
[Bindable(true),Category("Farver"), DefaultValue("")]
public Color ForeColor
{
get { return _style.ForeColor; }
set { _style.ForeColor = value; }
}
protected override void Render(HtmlTextWriter html)
{
_style.AddAttributesToRender( html );
html.AddAttribute("id","TableHeader");
html.AddAttribute("width","100%");
html.AddAttribute("class","test");
html.RenderBeginTag("table");
html.RenderBeginTag("TR");
html.RenderBeginTag("TD");
html.Write(headerText);
html.RenderEndTag();
html.RenderBeginTag("TD");
html.RenderEndTag();
html.RenderEndTag();
html.RenderBeginTag("TR");
html.RenderBeginTag("TD");
html.RenderEndTag();
html.RenderBeginTag("TD");
html.Write("Bruger: ");
html.Write(displayedUserName);
html.RenderEndTag();
html.RenderEndTag();
}
}
(xpostet in microsoft.public.dotnet.framework.aspnet.buildingcontrols,
microsoft.public.dotnet.framework.aspnet.webcontrols)
Regards
Anders