views:

46

answers:

1

How to use javascript in .ascx pages

+4  A: 

You can add script tags to the markup:

<script language="javascript">
   // place your javascript here
</script>


<script language="javascript" href="path to js file" />

Or use ScriptManager in the code behind so you don't include the same file/js section multiple times if you use multiple controls in a page.

You can find out more about ScriptManager here (overview, including usage scenarios).

Oded
gives error "Error on page".....java script function not called
Asad
@Asad - Without seeing the JS code and how you have included it, there isn't much information for me to go on.
Oded