November Happy Hour will be moved to Thursday December 5th.

Error on page

Vote:
 
I’m using the Conference-files, shipped with the EPiServer Sample Code, to make a page that can be used for discussions (a forum). Mostly I’ve made changes to the layout, so the functionality is pretty much the same as in the original Conference-files. Already from the start I’ve gotten an “Error on page”, and nothing on the page that has anything with the Conference-functionality to do respond on the page – in IE! The page works as it should in Firefox! When I first enter the page I get an “Object expected” (line:475, char: 1, code: 0, URL: to my page). Then, (after ignoring this, of course  ) when trying to expand the explorer tree, another error occurs too: “’containerElement’ is undefined” (line: 37, char: 3, code:0, URL: to my page), and nothing expands at all. In Conference.aspx.cs I had the following lines in Page_load: RegisterScriptFile("util/javascript/system.js"); And then I found something here at this forum, something that sounded kind of like my problems. And someone said that this line should be inserted into the aspx-file: if (!Page.IsClientScriptBlockRegistered("system.js")) { RegisterClientScriptBlock("system.js", ""); } So I replaced the RegisterScriptFile-line with the if-lines, and my problems were cut in half. I could expand the tree, but I couldn’t read the posted discussions, when trying nothing would happen. I continued with the development in Firefox, thinking that I would deal with these IE-problems later. And a few days later I was thinking about this problem again, with no ideas what to do. I took back the RegisterScriptFile-line again, compiled and looked for any changes, but I didn’t get any wanted effects, so I returned to the if-lines and all of a sudden I discovered that it worked also in IE – just like that! All of a sudden and out of the blue, the page worked fine in IE too. But I haven’t got a clue why, and what did it. Happy, I finished the development and sent everything to production… Only to discover that all of a sudden, these former problems and errors are back again!!! This time in production, and since it just worked out of the blue while developing it, I simply don’t know what to do to make it go away! Both errors are back, I can read the posted discussions, but I cannot expand the explorer tree. Please, can anyone help me?!
#12923
Feb 05, 2007 11:11
Vote:
 
Hello Sofie, Have you tried inserting the javascript reference directly into the HTML part of the aspx-file (not the code-behind)? ...or whatever the path to the system.js file is. I have no EPi-installation in reach right now. Anyway, this worked for me. Regards, /Marten
#15096
Feb 05, 2007 13:47
Vote:
 
It seems that the url to the script file is wrong. Causing the script call on line 475 not finding it's function. The first RegisterScriptFile will only work on a aspx file in the root like default.aspx since the link is relative to the page being executed. And the next will only work if the page being executed is located in a directory one level down from the root because of ../util The proper way to write the url to the script file would be: if (!Page.IsClientScriptBlockRegistered("system.js")) { RegisterClientScriptBlock("system.js", ""); } As you should with all url's in EPiServer. /HAXEN
#15097
Feb 09, 2007 11:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.