I need to call a JS function via codebehind when its no postback on a site.
I've added my script before the closing <head>
Tag:
<script type="text/javascript">
function StartWidgetTour() {
//init the tour!
wWidgetTour.init();
//finally start the tour! strange but we have to restart.
wWidgetTour.restart();
}
</script>
My Code looks like:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "Widget Tour Start!", "StartWidgetTour()", true);
//more code that already works
When I want to run this code, I get a built error The name 'ScriptManager' does not exist in the current context
.
I am already using namespace System.Web
and System.Web.UI;
.
The answers to this question didn't worked for me.
Thanks for any help!