Adding controls

J

Josema

Hi...

I have a web custom control (inherits from webcontrol) that has (by default) a button and a textbox, i would like to know how its possible, when i click this button, adding a button more "on the fly", wich dont dissapear when i click again this last button.... for example...

protected Button mybutton
protected TextBox mytextbox

protected override OnInit(

InitializeComponen

private void InitializeComponent(

//Instanciate the control
this.mybutton=new Button()
this.mytextbox=new TextBox()
//referencing the event
this.mybutton.click +=new Eventhandler....
//adding the controls to this webcustomcontro
this.controls.add(this.mybutton
this.controls.add(this.mytextbox


private void Onclick(.......

Button buttonextra=new Button()
buttonextra.click=new Event........(buttonextra_click)..
this.controls.add(buttonextra)



private void buttonextra(Object sender System.EventArgs

Response.write("hello world")


this example shows to me a button when i click the first button, but when i click the buttonextra this button dissapear, and i want that this generated button remains in the form permanently..

Thanks
Josema.
 
A

Alvin Bruney [MVP]

Your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Josema said:
Hi...

I have a web custom control (inherits from webcontrol) that has (by
default) a button and a textbox, i would like to know how its possible, when
i click this button, adding a button more "on the fly", wich dont dissapear
when i click again this last button.... for example....
protected Button mybutton;
protected TextBox mytextbox;

protected override OnInit()
{
InitializeComponent
}
private void InitializeComponent()
{
//Instanciate the controls
this.mybutton=new Button();
this.mytextbox=new TextBox();
//referencing the events
this.mybutton.click +=new Eventhandler....
//adding the controls to this webcustomcontrol
this.controls.add(this.mybutton)
this.controls.add(this.mytextbox)
}


private void Onclick(.......)
{
Button buttonextra=new Button();
buttonextra.click=new Event........(buttonextra_click)...
this.controls.add(buttonextra);

}

private void buttonextra(Object sender System.EventArgs)
{
Response.write("hello world");
}

this example shows to me a button when i click the first button, but when
i click the buttonextra this button dissapear, and i want that this
generated button remains in the form permanently...
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top