I came accross this problem today when converting a set of application pages into master pages.
My initial problem was that I had set CodeFile attribute of the @Page directive, rather than the CodeBehind attribute.
The second problem was that my page was inheriting from the Masterpage, rather than from System.Web.Ui.Page.
When I fixed these it worked.
It essence, if you get this error, check out what, and where your page is inheriting from.
Thursday, 4 June 2009
Tuesday, 2 June 2009
Outlook 2007 Email Headers
I keep forgetting where to find this one....
When you wish to see the header, right click on the message in your inbox and choose "Message Options". The window that pops up has the headers showing in it.
When you wish to see the header, right click on the message in your inbox and choose "Message Options". The window that pops up has the headers showing in it.
Tuesday, 19 May 2009
TinyMCE ListBox Plugin for Merge Tags
Well, today I finally managed to cobble together the following solution for a problem I had whereby I wanted a plugin for TinyMCE whereby I could select a value from a drop down / listbox, and have it inserted into TinyMCE.
So here's how I did it:
First define a javascript array BEFORE initialising the TinyMCE editor. This allows you to create this array server side if you want (by writing a response stream declaring it if necessary), or allows you to control it per page. E.g:
I created a new plugin in tiny_mce/plugins/usertags/editor_plugin.js as follows:
This you can then register as a plugin in tinymce.
So here's how I did it:
First define a javascript array BEFORE initialising the TinyMCE editor. This allows you to create this array server side if you want (by writing a response stream declaring it if necessary), or allows you to control it per page. E.g:
var arrUserTags = new Array('{{Name}}','{{Address}}','{{Company}}');I created a new plugin in tiny_mce/plugins/usertags/editor_plugin.js as follows:
(function() {
tinymce.create('tinymce.plugins.usertags', {
init : function(ed, url) {
},
createControl: function(n, cm) {
switch (n) {
case 'usertags':
var mlb = cm.createListBox('usertags', {
title : 'Insert details ',
onselect : function(v) {
tinyMCE.activeEditor.selection.setContent(v);
}
});
//The array arrUserTags, must be defined before the editor is added!!! Or if you prefer, just ignore the array idea, and just do multiple mlb.add() statements.
for(i=0;iThis you can then register as a plugin in tinymce.
CompareValidator doesn't compare numeric amounts correctly
Well at least that is what I thought today!
I had a compare validator set on two text boxes that were used to enter monetary amounts. The validator was to ensure that box B was greater than Box A.
In this scenario, it worked:
Box A = 100, Box B = 200 = Fine
But...
Box A = 500, Box B = 1000 = Invalid
Why? Because I hadn't set the TYPE attribute of the validator to CURRENCY
D'oh!
I had a compare validator set on two text boxes that were used to enter monetary amounts. The validator was to ensure that box B was greater than Box A.
In this scenario, it worked:
Box A = 100, Box B = 200 = Fine
But...
Box A = 500, Box B = 1000 = Invalid
Why? Because I hadn't set the TYPE attribute of the validator to CURRENCY
D'oh!
Thursday, 14 May 2009
TinyMCE UpdatePanel Javascript errors
I have spent days on this one, and it took myself and a colleague both working on it to find a solution that actually worked!
Here's the scenario.... you want to use TinyMCE, and have it working in an UpdatePanel. It sounds simple enough.
What I did was add the TinyMCE editor script, setup my tinyMCE.init() method, and hey presto, I got my editors. I set my code behind for my save button, and it fired fine when pressed, however, the editor disappeared! So, I moved my init function into the code behind, and registered it with the scriptmanager.registerclientscript method. This was fine, and when svaing my content, the editor did not disappear anymore - however, when I clicked the save button for a second time, I got a javascript error on the editor trying to access it's content.
The specific part of the javascript from tiny_mce.js was erroring on "return this.bodyElementthis.getDoc().body"
Anyway, I searched through many examples of how to solve this, including remove the editors before performing the postback, and eventually found a downloadable example that worked:
http://codeodyssey.com/archive/2007/7/18/updatepanel-tinymce-demo-with-project-zip-file
However, when I tried to use this in my application, with TinyMCE version 3.2.3, it didn't work. I copied over the version from this download, and then it seemed to fix the problem - but I lost some of the TinyMCE functionality!
Eventually, my colleague stumbled upon this absoluetly brilliant .NET extender, that handles everything for you, and allows you customise each editor independantly:
http://weblogs.asp.net/cjdevos/archive/2008/06/19/ajax-extender-for-tinymce-continued.aspx
So, if your having problems with TinyMCE and updatepanels - download it and use it!
Here's the scenario.... you want to use TinyMCE, and have it working in an UpdatePanel. It sounds simple enough.
What I did was add the TinyMCE editor script, setup my tinyMCE.init() method, and hey presto, I got my editors. I set my code behind for my save button, and it fired fine when pressed, however, the editor disappeared! So, I moved my init function into the code behind, and registered it with the scriptmanager.registerclientscript method. This was fine, and when svaing my content, the editor did not disappear anymore - however, when I clicked the save button for a second time, I got a javascript error on the editor trying to access it's content.
The specific part of the javascript from tiny_mce.js was erroring on "return this.bodyElementthis.getDoc().body"
Anyway, I searched through many examples of how to solve this, including remove the editors before performing the postback, and eventually found a downloadable example that worked:
http://codeodyssey.com/archive/2007/7/18/updatepanel-tinymce-demo-with-project-zip-file
However, when I tried to use this in my application, with TinyMCE version 3.2.3, it didn't work. I copied over the version from this download, and then it seemed to fix the problem - but I lost some of the TinyMCE functionality!
Eventually, my colleague stumbled upon this absoluetly brilliant .NET extender, that handles everything for you, and allows you customise each editor independantly:
http://weblogs.asp.net/cjdevos/archive/2008/06/19/ajax-extender-for-tinymce-continued.aspx
So, if your having problems with TinyMCE and updatepanels - download it and use it!
Wednesday, 15 April 2009
Math.Log in VBScript
Today I was working on an old Classic ASP project, and I was converting some JavaScript code to ASP.
Part of the code used the JavaScript Math.Pow function, e.g. Math.Pow(4,3), and I needed to do this in classic ASP.
I found that the ^ operator in VBScript does this, but it wasn't easy to transpose into my code, so I just added the following function to the page:
FUNCTION Pow(val, val2)
Pow = val ^ val2
END FUNCTION
Added called it as needed, e.g. Pow(4,3)
Part of the code used the JavaScript Math.Pow function, e.g. Math.Pow(4,3), and I needed to do this in classic ASP.
I found that the ^ operator in VBScript does this, but it wasn't easy to transpose into my code, so I just added the following function to the page:
FUNCTION Pow(val, val2)
Pow = val ^ val2
END FUNCTION
Added called it as needed, e.g. Pow(4,3)
Thursday, 12 February 2009
SWFObject and LightBox2 - IE Errors
Today a colleague of mine had a problem whereby he was trying to use LightBox 2 in a webpage, but on that page, we received the "Internet explorer cannot open the internet site XXX Operation Aborted" message, and the page doesn't load.
After a lot of debugging, nothing was apparent, and it didn't happen in Firefox.
After reading around a bit, it seems that IE has a few issues with DOM commands, and as such, the SWFObject and Lightbox2 scripts both try to access the DOM at the same time.
So, all I did was move the SWFObject script to the foot of the page, and keep the div that it is written into in its normal place.
Sorted.
After a lot of debugging, nothing was apparent, and it didn't happen in Firefox.
After reading around a bit, it seems that IE has a few issues with DOM commands, and as such, the SWFObject and Lightbox2 scripts both try to access the DOM at the same time.
So, all I did was move the SWFObject script to the foot of the page, and keep the div that it is written into in its normal place.
Sorted.
Subscribe to:
Posts (Atom)