472,146 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

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 1096

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
reply views Thread by Saiars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.