JScript Error

Dec 15, 2011 at 12:36 AM

I created a simple web page with the Ribbon control on it and when I run it gives me the error

Microsoft JScript runtime error: The value of the property '$' is null or undefined, not a Function object

My HTML is

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebEMSBill._Default" %>


<%
@ Register Assembly="OfficeWebUI" Namespace="OfficeWebUI" TagPrefix="cc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!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></title>
</
head >
<
body>
<form id="form1" runat="server"> 
<cc1:Manager ID="Manager1" runat="server"/>
<div>
<cc1:OfficeRibbon runat="server" ApplicationMenuColor="Blue" 
ApplicationMenuType="Default" 
ApplicationMenuText="WebEMS" 
ID="MainRibbon" 
Visible="true"> 
</cc1:OfficeRibbon>
</div>
</form>
</
body>
</
html >

Anyone got any ideas whats wrong here?

Dec 15, 2011 at 8:39 AM

You are missing the Jquery library.

You need to either include the below attribute in the Manager Tag ot else include the latest library yourself.

IncludeJQuery="true"

Dec 15, 2011 at 11:17 AM

Thank you.  That fixed that problem.   Now I am getting an error:

Microsoft JScript runtime error: Unable to get value of the property 'find': object is null or undefined

The JScript code it is stopping at is:

 

 

ActiveTab.find(
"DIV.RibbonGroupCollapsedContainer, DIV.RibbonGroupContent").each(function(idx) {

var _element = $(this);
if (_element.css("display") != "none")

_TotalElementsWidth = _TotalElementsWidth + _element.width();

 

});

 

Dec 15, 2011 at 2:04 PM

I personally used linked to the jquery library directly and set the IncludeJquery to false, but i doubt if I ever got this error.

Do however have a look at the demo project, You might need to beef up your code a little, and add some more controls, like tabs, Groups and zones.  this may be causing it as these (DIV.RibbonGroupCollapsedContainer, DIV.RibbonGroupContent) are probably not being created in code cause you don't have any groups created.

 

 

Dec 15, 2011 at 2:44 PM

I apologize for all my questions, etc. but this is quite new to me.   I am WinForms developer trying to get the ribbon to work in my first major ASP.NET project.

I am not sure about the jquery library or its location.   I cannot seem to locate and how to link it.  It that via reference?  What is the name of the library?.

I have looked all over the web and cannot find the demo project.  It would be very useful in that it would show me a lot of techniques, etc.   Sadly, there does not appear to be much, if any, documentation on this package.   It does look very good from all the things I have seen on the website.

Thanks again for your help.

Bryan

Dec 16, 2011 at 2:11 PM

Hey Bryan,

So re demo project you can find it under downloads, other downloads version 2.4 Source + demo.  Use that for demo apps, but use latest release for office web ui library.

Re Jquery, you can find more info at www.jquery.com.  The includeJQuery attribute i indicated before, will add the library for you.

Jquery but in short is a javacript library which extends the javascript language to a whole new level.  It is references in the head tag in a <script> block, just like any other javascript file.  You can also find cached version of the jquery library on google http://code.google.com/apis/libraries/devguide.html.

In the case of the ribbon,  Jquery is used, and therefore you have the option to have the manager include it at runtime.

AJM

Dec 18, 2011 at 8:34 PM

thanks for the update.   I found the demo project and have built my ribbon however, I am having a problem in integrating the master page with the actual pages.

I am using the the usual ASP.NET convention of of using the content place holder tag in both the master page and the actual page but for some reason my content appears above the ribbon and not below it where one would expect it to appear.  Am I missing something?

 

Bryan

Dec 19, 2011 at 11:44 AM

Did you solve this issue?

If not maybe some things you can check:
Did you place the ContentPlaceHolder within the OfficeWorkspace like in the demo, within its content tag?
Do you have more then one content Place holder?
If so are you placing your content in the correct placeholder?

Dec 19, 2011 at 10:28 PM

DOH!!

I should have seen that I put the content in the wrong placeholder.   Sorry about that.  We are on our way to building a great application.

 

Bryan

Dec 19, 2011 at 11:03 PM

Ok... Now you are going to hate me....  After getting the place holder thing to work, I wanted to hide the left panel in the Workspace and leave only the main panel.

All attempts to resize it or make it invisible result in a "object reference not set to the instance of an object" on the object "this._leftpanel".    This happens not only in my application but when I tries to play with it in the demo project, it does the same thing.    Did somebody miss something in testing/debugging?   Not everyone wants the left panel in their application.

 

 

Bryan

Dec 20, 2011 at 5:21 AM

Hey Bryan,

Set it in code. On_init .. had the same problem

 

this.Workspace1.ShowLeftPanel = false;

Dec 20, 2011 at 11:23 AM

thanks for the tip.    Another question, is there any way to keep the ribbon visible without refreshing the page so that only the workspace is refreshed?   It['s not important but it would look much nicer if that could be done.

Bryan

Dec 20, 2011 at 2:08 PM

Hey,

Honestly never tried, but i don't think it is something that can be done out of the box.  The backstage can do this, through controls, but I think it works with ajax enabled controls only because if you had to do a postback or refresh in any way you will not be able to get back in the backstage page you where in.

If you find a way please do share... would be great to get my application working that way too.

Anthony

 

Dec 21, 2011 at 6:43 PM

I haven't found the answer (yet) to the panel issue but am still working on it.   However, I have apparently lost all my tabs.   All I see is the ribbon for the first tab but without the tab itself showing.   I have 4 tabs in my application.   I have compared the structure of my code to the example project and cannot for the life of me see why I don't have any tabs showing.    It likely is something simple and I cannot see it.   Any ideas what to look for?

Thanks again for all your help.

Dec 21, 2011 at 6:55 PM

Well I finally stumbled across my disappeared tab problem.   On the RibbonContext tag there is a Text property that I thought one could use but if you put something in it, the tabs disappar.   Can you (or anyone) explain the purpose of the text property if you cannot put any text into it?

Bryan