Home All Groups Group Topic Archive Search About
Author
14 Jun 2006 12:41 PM
Paul
Hello:

I create a textbox control programatically something like this:

Dim td As New TableCell()
Dim txtbox As New TextBox()
txtbox.ID = "my_textbox"
td.Controls.Add(txtbox)

Now I want to programatically associate a "OnTextChanged" event to this
textbox.

How can I do this?

When I view the page source, the ID of the textbox control is something like
"ctl00$my_textbox". So the textbox ID actually gets changed.

Can anyone point me to an example or a link that explains how to do this?

TIA.

- Paul

Author
14 Jun 2006 3:24 PM
Balasubramanian Ramanathan
for serverside event associate the TextChanged event

If you want to refer this textbox in the client side use the ClientId
property of the control.


Show quoteHide quote
"Paul" <P***@discussions.microsoft.com> wrote in message
news:C1CC08D0-7639-4024-BE52-7B1CAB58CE10@microsoft.com...
> Hello:
>
> I create a textbox control programatically something like this:
>
> Dim td As New TableCell()
> Dim txtbox As New TextBox()
> txtbox.ID = "my_textbox"
> td.Controls.Add(txtbox)
>
> Now I want to programatically associate a "OnTextChanged" event to this
> textbox.
>
> How can I do this?
>
> When I view the page source, the ID of the textbox control is something
> like
> "ctl00$my_textbox". So the textbox ID actually gets changed.
>
> Can anyone point me to an example or a link that explains how to do this?
>
> TIA.
>
> - Paul