tags:

views:

705

answers:

3

Hi, I'm trying to use jGrowl in an aspx page. But I encountered a problem that I couldn't solve. When I use a regular aspx page the jGrowl is working fine. however when I use the page with a MasterPage the jGrowl is not working ,I got a javascript error saying $.jGrowl is not a function.

From Firebug Console, I can query $; $("a"); they return objects. Which means jquery is loaded, but $.jGrowl("hello world"); return "$.jGrowl is not a function."

Here is the sample code I'm using

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="growl.aspx.vb" Inherits="growl"
MasterPageFile="~/MyMaster.Master" Title="growl" %>

<script language="javascript" type="text/javascript" src="Scripts/jquery.min.js"></script>

<script language="javascript" type="text/javascript" src="Scripts/jquery.jgrowl.js"></script>

<script language="javascript" type="text/javascript" src="Scripts/jquery-ui.min.js"></script>

<asp:Content ID="maincontent1" runat="server" ContentPlaceHolderID="MainContent">
$(document).ready(function() { $('#demo12').click(function() { $.jGrowl("Growl Notification");
}); });
<button id="demo12" type="reset" onclick="$.jGrowl('Hello WORLD');">
    DEMO</button>

The master page contains an Asp:ScriptManager.

Any help is very appreciate it.

Thanks,

A: 

Have you tried using jQuery.noConflict() and jQuery.jGrowl() to see if there is a conflict with the $ function between jQuery and the Microsoft javascript libraries?

tvanfosson
I tried it but still getting TypeError: jQuery.jGrowl is not a function
Youssef
I don't know if this is part of the problem, but $('#demo12') won't work with a master page due to the name mangling. You'll need to use $('[id$=demo12]') -- i.e., find the element whose id ends with demo12.
tvanfosson
A: 

Might be obvious, but can you check if you are correctly referencing the library? You might have the wrong path.

jdelator
it is the right library , I checked the script loaded using Firebug.
Youssef
A: 

I found my problem. It was a literal in the MasterPage that is set in the page_Load to include the javascript library. When I removed it it works fine.

Thanks guys for your help.

Youssef