Custom web control with two TextBox inside a panel

G

Guest

Hi,

Would you give me a idea how to create a web control with two Textbox ?

my code :

namespace com.index.web.components
{
[DefaultProperty("Text")]
[ToolboxData("<{0}:WebCustomControl1
runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : WebControl
{
public TextBox textBox1
{
get
{
TextBox box = (TextBox)ViewState["textBox1"];
return box;
}

set
{
ViewState["textBox1"] = value;
}
}


public TextBox textBox2
{
get
{
TextBox box = (TextBox)ViewState["textBox2"];
return box;
}

set
{
ViewState["textBox2"] = value;
}
}

protected override void RenderContents(HtmlTextWriter output)
{
output.Write(textBox1);
output.Write(textBox2);
}
}
}
 

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