Click here to Skip to main content
15,904,287 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have aspx page with jquery and javascript and again on the same webproject in menu master file I have another version of jQuery and javascript. Since this two types of java script present on the same project when i load the the project I get the error "Microsoft JScript runtime error: Object doesn't support this property or method"

I i comment the menu master file java script and jquery it works fine. Can anyone help me how to make it work with out commenting it.

ASP.NET
<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Menu.master" AutoEventWireup="true"
    CodeFile="ObjectRepositoryPages.aspx.cs" Inherits="ObjectRepositoryPages" %>

<%@ MasterType VirtualPath="~/Master/Menu.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<script src="Scripts/jquery.js" type="text/javascript"></script>
<script src="Scripts/colResizable-1.3.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.cookie.js" type="text/javascript"></script>
 <script type="text/javascript">
     $(document).ready(function () {
         if ($.cookie('colWidth') != null) {
             var columns = $.cookie('colWidth').split(',');
             var i = 0;
             $('.GridViewStyle th').each(function () {
                 $(this).width(columns[i++]);
             });
         }

         $(".GridViewStyle").colResizable({
             liveDrag: true,
             gripInnerHtml: "<div class='grip'></div>",
             draggingClass: "dragging",
             onResize: onSampleResized
         });

     });

     var onSampleResized = function (e) {
         var columns = $(e.currentTarget).find("th");
         var msg = "";
         columns.each(function () { msg += $(this).width() + ","; })
         $.cookie("colWidth", msg);
     }; 
</script> 


ASP.NET
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Menu.master.cs" Inherits="Master_Menu" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Universal Test Automation Framework</title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
    <link href="../Script/MainWindow.css" rel="stylesheet" type="text/css" />
   <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
   <script type="text/javascript">
 $(document).ready(function () {
            try {

                $("#buttomLeftSide").bind("contextmenu", function (e) {
                    e.preventDefault();
                    $("#custom-menu").css({ top: e.pageY + "px", left: e.pageX + "px" }).show(100);
                });
                $(document).mouseup(function (e) {
                    var container = $("#custom-menu");
                    if (container.has(e.target).length == 0) {
                        container.hide();
                    }
                });
            }
            catch (err) {
                alert(err);
            }
        });
    </script>
Posted
Updated 2-Dec-13 19:32pm
v3

U can use jquery.noConflict() method, if you r using two different versions of Jquery.
But i'll suggest you to use the latest only.....
 
Share this answer
 
Comments
ShaHam11 3-Dec-13 5:21am    
I am novice developer can you please tell me where to include the jquery.noConflict() in which file as you can see there 2 files above
ShaHam11 3-Dec-13 5:29am    
Hi Jain I placed $.noConflict(); right below the <script type="text/javascript"> on both the pages and tried placing it on single page as well but no luck still its not working...let me tell i Comment the menu.cs file script the code works perfectly but i cant do that
Sampath Lokuge 4-Dec-13 3:35am    
+ 5
Why do you need to use 2 jQuery versions ? Just use the latest one (in your case I hope it's jquery-1.8.2.js).B'cos it's having backward compatibility.So try it and let me know if you have further issues.
 
Share this answer
 
v2
Comments
ShaHam11 3-Dec-13 1:59am    
I Used the latest one jquery-1.8.2.js to the above file still its not running
Sampath Lokuge 3-Dec-13 2:02am    
Can you just update the latest code snippets with your changes on above your question (Plz update both places (menu and master)) ?After that let me know.
ShaHam11 3-Dec-13 4:17am    
ObjectRepositorypage.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Menu.master" AutoEventWireup="true"
CodeFile="ObjectRepositoryPages.aspx.cs" Inherits="ObjectRepositoryPages" %>

<%@ MasterType VirtualPath="~/Master/Menu.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<%--<script src="Scripts/jquery.js" type="text/javascript"></script>--%>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>

<script src="Scripts/colResizable-1.3.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.cookie.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
if ($.cookie('colWidth') != null) {
var columns = $.cookie('colWidth').split(',');
var i = 0;
$('.GridViewStyle th').each(function () {
$(this).width(columns[i++]);
});
}

$(".GridViewStyle").colResizable({
liveDrag: true,
gripInnerHtml: "<div class='grip'></div>",
draggingClass: "dragging",
onResize: onSampleResized
});

});

var onSampleResized = function (e) {
var columns = $(e.currentTarget).find("th");
var msg = "";
columns.each(function () { msg += $(this).width() + ","; })
$.cookie("colWidth", msg);
};
</script>

Menu page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Universal Test Automation Framework</title>
<asp:ContentPlaceHolder ID="head" runat="server">

<link href="../Script/MainWindow.css" rel="stylesheet" type="text/css" />
<%--<script src="../Scripts/jquery.js" type="text/javascript"></script>--%>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>

<script type='text/javascript' language="javascript">
$(document).ready(function () {
try {

$("#buttomLeftSide").bind("contextmenu", function (e) {
e.preventDefault();
$("#custom-menu").css({ top: e.pageY + "px", left: e.pageX + "px" }).show(100);
});
$(document).mouseup(function (e) {
var container = $("#custom-menu");
if (container.has(e.target).length == 0) {
container.hide();
}
});
}
catch (err) {
alert(err);
}
});

</script>
ShaHam11 3-Dec-13 4:18am    
As you can see i have updated the latest jquery <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script> on both the pages and the other one jquery.js i have commented it
ShaHam11 3-Dec-13 4:19am    
Thank you so much for your help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900