0

I have a webform which contains some LinkButtons.
When each LinkButton is clicked I want to load a different UserControl.
I also want to do it with Ajax.

I tried it in two ways as described here and here
[Both approaches use an UpdatePanel, the first adds the user control and changes its Visible attribute, the second uses LoadControl function]

Both works (upvoted them!) but I still have a problem-
I can't run javascripts within the user controls...
It doesn't recognize any function

When the user controls were added not dynamically it all went well

The only workaround I found was to move the javascript from the user control to the page but that's not nice...

Also tried this with no luck

Any help will be appriciated

Community
  • 1
  • 1
A.B.Cade
  • 16,735
  • 1
  • 37
  • 53

1 Answers1

2

For asynchronous requests use ScriptManager.RegisterStartupScript method

Yuriy Rozhovetskiy
  • 22,270
  • 4
  • 37
  • 68
  • Damn! I was so close when I was looking at http://stackoverflow.com/a/4416711/1083652 ... Anyway, your answer works - thanks! – A.B.Cade Oct 10 '12 at 13:40