Web custom control

W

Wilson Wu

Hi,

I want to create a custom label control using the following code. But the
lable can't display. what is wrong ?

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;

namespace com.Index.WilsonWebClass
{
/// <summary>
/// Summary description for wLabel.
/// </summary>
///

[DefaultProperty("Text"),
ToolboxData("<{0}:wLabel runat=server></{0}:wLabel>")]
public class wLabel : System.Web.UI.WebControls.Label
{
private string text;


[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string Text
{
get
{
return text;
}

set
{
text = value;
}
}

/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)
{
output.Write(Text);
}

}

}
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi,

The code snippet by itself looks pretty solid.
What's the exact problem (or error) you are getting? Can it be that there's
something wrong in the code that creates and initializes the label?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top