469,625 Members | 1,123 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

Problems with sending javascript from dynamically loaded control

I have problems with sending javascript to the client from a dynamically
loaded usercontrol.

I have a single page that dynamically loads controls into a table cell in
a HTML-table. For one of these controls I would like to add some
javascript to the page loading my control. The problem is only - nothing
happens. The code that loads my usercontrol from my ASPX-page is:

tdContent.Controls.Add(Page.LoadControl(contentCon trol));

Where "tdContent" is a table cell and the variable "contentControl" is
the physical path to my usercontrol's ASCX-file.

I would think that I could do it like this (from my ASCX-file):

protected override void OnInit(EventArgs e)
this.GetType(), "key", "alert('foo');", true);

Som alas nothing happens. I have a gut feeling that it is due to the fact
that the HTML of my ASPX-page has been created when I try to add to it
from my usercontrol, but I have found nowhere in the doc that could bring
me closer to a explanation.

Any of you guys have an idea of what to do?

Jesper Lund Stocholm
Nov 26 '06 #1
0 1026

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Donald Xie | last post: by
4 posts views Thread by Harry | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.