FCKEditor and ASP.Net Fix

I'm not sure I'd call this a fix, more of an addition. Anyway, I've talked a couple of times about things that need to be changed with regard to the .Net Control that they have every once in a while. This time around it was more of an annoyance of mine. You see, I like to have a very well defined directory structure for my uploads. Images go in the images directory, etc. This works fine with FCK, as it puts images, media, flash files, etc. all in different folders. However, I like to take things further and divide things based on entries/pages. So for instance, I would prefer to have this post use a different directory for uploads and another post use a different directory. With FCK this is a pain to do but it's doable. You simply switch the FCKeditor:UserFilesPath application setting to the directory that you want. I find that annoying though. So instead I recommend the following function:

        [DefaultValue("/uploads/")]
        public string UploadPath
        {
            get
            {
                object o = ViewState["UploadPath"];

                if (o == null)
                    o = System.Configuration.ConfigurationSettings.AppSettings["FCKeditor:UserFilesPath"];

                return (o == null ? "/uploads/" : (string)o);
            }
            set { ViewState["UploadPath"] = value; System.Configuration.ConfigurationSettings.AppSettings["FCKeditor:UserFilesPath"] = value; }
        }

Add that function to the FckEditor class in the FCK Control (FCKeditor.cs file)... All that function does, is allows you to programmitcally change the FCK editor's upload location on the object itself. It's rather basic but has been annoying the heck out of me for a little bit now. In theory they're working on improving this but in the mean time, you might as well just add the function above. Anyway, it might not be the most useful bit of code but it annoyed me to no end for a day or two so I figured I'd share. So try it out, leave feedback, and happy coding.

kick it on DotNetKicks.com   Shout it
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkListEmail

Posted by: James Craig
Posted on: 10/27/2008 at 1:14 PM
Tags: ,
Categories: ASP.Net | Web Design
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

More issues with FCKEditor

I've really been trying my best to enjoy using FCKEditor... Let's just say it's trying my patience. Actually I take that back, using it is great. Trying to get it to work on an ASP.Net page when AJAX is involved is what's driving me up a wall...

Specifically, FCKEditor doesn't like being inside of an UpdatePanel as it will forget what is typed into it. Nor does it like being hidden during a partial post back. Nor does it like to reappear after being hidden. Nor does it like to... Well you get the idea. Anyway, most of these problems are easily fixed for the most part and thankfully I didn't even have to come up with said fix. Joshua Coady has one that works quite well on his site here. However, the fix seems to only really work for IE and at best partially for Firefox. In Firefox, it will save the information during the partial postback, but you're going to get some javascript errors (the number of errors go up based on the number of times you hide and unhide the FCKEditor).

Anyway, assuming I get FCKEditor to work (and not just this partial fix) I should be back to posting helpful information/code again. Either that or I'll go crazy on this one problem. In the mean time, happy coding.

kick it on DotNetKicks.com   Shout it
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkListEmail

Posted by: James Craig
Posted on: 8/8/2008 at 2:46 PM
Tags:
Categories: AJAX | ASP.Net
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

FCKEditor issue with .Net and fix

I've been going through various WYSIWYG editors lately. At work we use KTML (which no longer exists, so no point in looking for it). It use to be a Dreamweaver extension created by InterAKT. To be honest, I have no idea why it was picked over the multitude of other options. And I can say without a shadow of a doubt, that I hate it. It never quite outputs the correct mark up (or at least not what you'd expect), has issues with tables, etc. So I've been looking for other items out there to replace it.

The two items I ended up looking at were TinyMCE and FCKEditor. I currently use TinyMCE on the site here, so I wanted to get a bit more experience with FCKEditor so I could make a decision. Downloaded the code, the .Net adapter, etc. and tried it out. Instantly I was struck with issues when it came to uploading files (and I had set up the config correctly). There is a small issue that you will run into with the connector.aspx file if you're using themes. Specifically, it doesn't have a header. You have to have a header if you're going to use themes. So all you need to do is go into the file and switch


<FCKeditor:Config id="Config" runat="server"></FCKeditor:Config>

to


<FCKeditor:Config id="Config" runat="server"></FCKeditor:Config>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
</head>
</html>

This annoyed me to no end as I wasn't even getting an error message... Anyway, hopefully this helps you out and you don't have to deal with the same issues that I did...

kick it on DotNetKicks.com   Shout it
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkListEmail

Posted by: James Craig
Posted on: 6/12/2008 at 1:05 PM
Tags: ,
Categories: ASP.Net | Web Design
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed