Problem with helpers or stylesheets?????

Mar 16, 2011 at 11:07 PM

Have tried using html editor in own project but get the following error in  ControlBase.cs protected virtual void InitializeCSSRegistration()

Line 604:            {
Line 605:                if (RenderTreeViewStyles)
Line 606:                    Helper.RegisterSharedExternalStyleSheetReferences(this.Page,
Line 607:                        QueryStringData(CssFile.Shared), QueryStringData(CssFile.TreeView));
Line 608:                if (RenderSharedStyles

[NullReferenceException: Object reference not set to an instance of an object.]
   Typps.Helper.RegisterSharedExternalStyleSheetReferences(Page p, String sharedCssQueryString, String treeviewCssQueryString) in c:\Typps.Web\Typps\Utilities\Helper.cs:421
   Typps.ControlBase.InitializeCSSRegistration() in c:\Typps.Web\Typps\Base\ControlBase.cs:606
   Typps.Editor.InitializeCSSRegistration() in c:\Typps.Web\Typps\Controls\Editor.cs:2959
   Typps.ControlBase.RenderStylesAndScripts() in c:\Typps.Web\Typps\Base\ControlBase.cs:725
   Typps.Editor.RenderStylesAndScripts() in c:\Typps.Web\Typps\Controls\Editor.cs:3123
   Typps.Editor.OnPreRender(EventArgs e) in c:\Typps.Web\Typps\Controls\Editor.cs:3056
   System.Web.UI.Control.PreRenderRecursiveInternal() +103
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

I get the demo project to work ok, stripped it down to bear essentails I need, still works then added those to my own project which is an MVC application

Can you give any pointers of where to look or how better to debug the problem

any help greatly appreciated

Mar 17, 2011 at 12:09 AM

Hello, we don't support MVC at the moment. It's planned for a future release.

Best regards,


Mar 17, 2011 at 1:18 AM

do you think the problem is with MVC?

I have an aspx file see below, I was thinking maybe I'm forgetting to include something, I think I included evrything from the web.config file, I know the file's not the MVC way of doing things but...

any insight or pointers much appreciated

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ClubWebsite.Models.WebContent>" ValidateRequest="false" %>

<%@ Import Namespace="System.IO" %>
<%@ Register Assembly="Typps" Namespace="Typps" TagPrefix="t" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)

    protected void ImagePicker_BrowseServerRequest(object sender, EventArgs e)
        //This handler fires when :
        //1) You click the Browse Server button on the Image designer dialog for~ the first time
        //2) When you use the file upload button to upload an image, and then
        //clicking Browse server again will trigger this
        //3) This is indeed the best place to enumerate your images and it fires during pre_render phase
        //this means quite late in the page life cycle giving you a lot of time to do other things
        //such as saving your files on the server during a file upload operation *before* building
        //the nodes for the gallery.
    void PopulateImageGallery(ImagePicker ip)
        //fill our image gallery with images browsable on the server
        string imagesDirectoryPath = Server.MapPath(@"~/UploadedImages/");
        /*not the best example to set titles but it's easy for demo*/
        string[] billgates ={"If you can't make it good, at least make it look good",
                                "Life is not fair, get used to it",
                                "Your most unhappy customers are your greatest source of learning",
                                "Patience is a key element of success"};
        DirectoryInfo di = new DirectoryInfo(imagesDirectoryPath);
        if (di.Exists)
            ip.ImageGalleryNode.Text = di.Name;//The folder
            //Now lets add all images to this parent node so
            //it seems like this :
                - Images
                    - imageselection1.jpg
                    - Image2.jpg

           /*** loop subdirectories */

           FileInfo[] files = di.GetFiles();
            int index = 0;
            foreach (FileInfo file in files)
                string pathToImageFile = ResolveUrl(
                     string.Format(@"~/UploadedImages/{0}", file.Name));

                //create a new HTreeNode
                HTreeNode tr1 = new HTreeNode();
                tr1.Text = file.Name;
                tr1.Value = pathToImageFile;
                tr1.ToolTip = billgates[index++];
                if (index == billgates.Length)
                    index = 0;//recycle, we just ran out of quotes
                //add it to the root node, since we only have one folder


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Edit Home Page

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Edit Home Page</h2>

  <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" ScriptMode="Debug" runat="server">
<h1>Typps HTML Editor</h1>
    <t:Editor ID="Editor1" Skin="KnightRider" Height="500px" EnableViewState="false" IconsMode="ImageSprites" runat="server">
         <EmbeddedImagePicker ID="ImagePicker1"
            OnBrowseServerRequest="ImagePicker_BrowseServerRequest" runat="server">
    <br style="clear:both"/>
    <p>Documentation and more demos coming soon.</p>
    <h1> Upload Image</h1>
     <div class="margin">
        (click the icon below to launch the Image uploader)</div>
    <t:ImagePicker ID="ImagePicker2" runat="server"
    <span id="label1" class="margin"></span>

    <script type="text/javascript">
        var label1 = $get('label1');
        function ImagePicker2_OK(sender, args) {
            if (label1 != null) {
                var savedPath = args.get_commandArgument();
                if (savedPath.length > 0)
                    label1.innerHTML = String.format("The file {0} was uploaded successfully", args.get_commandArgument());
                    label1.innerHTML = 'File wasn\'t saved';


    <script runat="server">
    protected void ImagePicker2_ImageUploaded(object sender,
        UploadedImageFileEventArgs e)
            // Specify the path on the server to
            // save the uploaded file to.
            string savePath = @"~/UploadedImages/";

            HttpPostedFile hpf = e.PostedImageFile;
            // Get the name of the file to upload.
            string fileName = hpf.FileName;

            // Append the name of the file to upload to the path.
            string[] s = fileName.Split('\\');
            savePath += s[s.Length - 1]; // fileName;

            // Call the SaveAs method to save the
            // uploaded file to the specified path.
            // This example does not perform all
            // the necessary error checking.              
            // If a file with the same name
            // already exists in the specified path, 
            // the uploaded file overwrites it.

            // Notify the client side of the name of the file
            // and path it was saved under, in case you want
            //this information client side
            e.MessageToClient = fileName;//savePath;
        catch (Exception ex)
            //Uploading files can be an error-prone affair. It is important to
            //upload files in your code using proper exception handling. Typical problem
            //is not having write permissions to the folder etc. In the end, it's your call.
            e.MessageToClient = ex.Message;


<asp:Content ID="Content3" ContentPlaceHolderID="MetaContent" runat="server">

<asp:Content ID="Content4" ContentPlaceHolderID="LeftContent" runat="server">

<asp:Content ID="Content5" ContentPlaceHolderID="RightContent" runat="server">

Mar 17, 2011 at 1:26 AM

hi, the project in its current state has a strong dependency on webforms and the page life cycle. Any effort you make will simply be a hack and most likely give you more problems in the long run.

I apologize for this inconvenience. To support MVC we are going to undergo a rewrite sadly, which is much needed anyway. 


Mar 17, 2011 at 1:36 AM

Thanks Alessandro,

the re-write may come too late for me but good luck, from what I've seen so far it will be worth it

Thanks again for your prompt & honest replies