Thread View: borland.public.delphi.aspdotnet.components.using
3 messages
3 total messages
Started by Fabricio Vargas Matos
Fri, 09 Sep 2005 05:55
Adding webcontrols at running time
Author: Fabricio Vargas Matos
Date: Fri, 09 Sep 2005 05:55
Date: Fri, 09 Sep 2005 05:55
16 lines
1325 bytes
1325 bytes
Can I instantiate a new webcontrol (a TextBox, for example) at runtime? I would like to do something like: TextBox := System.Web.UI.WebControls.TextBox.Create; TextBox.Page := self; ... and have a new TextBox in the web page. But, of course, there ins't any reference of this TextBox in the aspx file, so.... Any idea? Thanks, Fabricio.
Re: Adding webcontrols at running time
Author: Marco Caspers
Date: Fri, 09 Sep 2005 08:05
Date: Fri, 09 Sep 2005 08:05
23 lines
1330 bytes
1330 bytes
Fabricio Vargas Matos wrote: > Can I instantiate a new webcontrol (a TextBox, for example) at > runtime? > I would like to do something like: > TextBox := System.Web.UI.WebControls.TextBox.Create; > TextBox.Page := self; > ... > and have a new TextBox in the web page. Yup, easy, almost like you did: TextBox := WebControls.TextBox.Create(); Self.Page.Controls.Add(TextBox); > But, of course, there ins't any reference of this TextBox in the aspx > file, so.... Not a problem, as long as you add it to the controls list. Hth, Marco.
Re: Adding webcontrols at running time
Author: Ivan Revelli
Date: Tue, 11 Oct 2005 09:32
Date: Tue, 11 Oct 2005 09:32
37 lines
1933 bytes
1933 bytes
Hi,
only a little adding, if you want to assign a method to a button for
example you need to write a method and use Include(<>,<>) directive to
assigne the event andler.
bst rgds
Ivan
info@csdrevelli.it
http://www.csdrevelli.it
"Marco Caspers" <hexor_haxor@vaxor.com> ha scritto nel messaggio
news:43214254@newsgroups.borland.com...
> Fabricio Vargas Matos wrote:
>
> > Can I instantiate a new webcontrol (a TextBox, for example) at
> > runtime?
> > I would like to do something like:
> > TextBox := System.Web.UI.WebControls.TextBox.Create;
> > TextBox.Page := self;
> > ...
> > and have a new TextBox in the web page.
>
> Yup, easy, almost like you did:
>
> TextBox := WebControls.TextBox.Create();
> Self.Page.Controls.Add(TextBox);
>
> > But, of course, there ins't any reference of this TextBox in the aspx
> > file, so....
> Not a problem, as long as you add it to the controls list.
>
>
> Hth,
> Marco.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads