Hello Daniweb!

I'm an amateur programmer who's learned quite a bit from online references, and usually searching eventually reveals the problem but I'm stuck!

I've overcome many obstacles when creating a custom button on the Ajax Editor control, namespace issues, registring the controls properly etc. I resist the temptation to ask for help because the errors should lead me in the right direction. Now I get no errors, but the control isn't visible! The tag is in the .ASP page and I even set the width, height and visible tags in case it's being hidden but nothing shows up.

This is my MaintainKB.aspx

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="MaintainKB.aspx.vb" ValidateRequest="false" Inherits="Quartet_KB.WebForm6" %>

<%@ Register TagPrefix="cus" TagName="KBCustomHtmlEditor" Src="~/KBCustomHtmlEditor.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:PlaceHolder id="MessagePlaceHolder" runat="server"></asp:PlaceHolder>
    <asp:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
    <table class="pageheadertable">
            <td width="50%" class="pageheadertable">
                Maintain KB article:
                <asp:Label ID="lKbNumber" runat="server"></asp:Label>
    <br />
    <table class="subpageheadertable">
                <asp:Label ID="lSubject" runat="server" Text="Subject"></asp:Label>
                <asp:TextBox ID="tSubject" runat="server" Width="400px"></asp:TextBox>
                <asp:Label ID="lKeywords" runat="server" Text="Keywords"></asp:Label>
                <asp:TextBox ID="tKeywords" runat="server" Width="400px"></asp:TextBox>
            <td colspan="2">
                <asp:Button ID="bSave" runat="server" Text="Save" />
                <asp:Button ID="bCancel" runat="server" Text="Cancel" />
    <br />
    <cus:KBCustomHtmlEditor ID="textHTML" width="100%" height="200px" Visible="true" runat="server" />

<script language="javascript" type="text/javascript">
    function show() {

        document.getElementById("<%=dv.ClientID%>").style.display = '';
        document.getElementById("<%=FileUploadControl.ClientID%>").style.display = '';
        document.getElementById("<%=btnUpload.ClientID%>").style.display = '';
        document.getElementById("<%=btnCancel.ClientID%>").style.display = '';

    function hide() {
        document.getElementById("<%=dv.ClientID%>").style.display = "none";
        document.getElementById("<%=FileUploadControl.ClientID%>").style.display = "none";
        document.getElementById("<%=btnUpload.ClientID%>").style.display = "none";
        document.getElementById("<%=btnCancel.ClientID%>").style.display = "none";

    function showFloatDiv() {

        if (!e) {
            var e = window.event || arguments.callee.caller.arguments[0];
        var scrolledV = scrollV();
        var scrolledH = (navigator.appName == 'Netscape') ? document.body.scrollLeft : document.body.scrollLeft;
        tempX = (navigator.appName == 'Netscape') ? e.clientX : event.clientX;
        tempY = (navigator.appName == 'Netscape') ? e.clientY : event.clientY;
        document.getElementById("<%=dv.ClientID%>").style.left = (tempX + scrolledH) + 'px';
        document.getElementById("<%=dv.ClientID%>").style.top = (tempY + scrolledV) + 'px';
        document.getElementById("<%=dv.ClientID%>").style.display = "";

    function scrollV() {
        var scrolledV;
        if (window.pageYOffset) {
            scrolledV = window.pageYOffset;
        else if (document.documentElement && document.documentElement.scrollTop) {
            scrolledV = document.documentElement.scrollTop;
        else if (document.body) {
            scrolledV = document.body.scrollTop;
        return scrolledV;

And here is the KBCustomHtmlEditor.vb file where I modify my control.

Imports AjaxControlToolkit.HTMLEditor

Namespace MyControls
    Public Class KbCustomHtmlEditor
        Inherits Editor
        Private Shared _editorBlogID As Integer = -1
        Public Shared Property EditorBlogID() As Integer
                Return _editorBlogID
            End Get
            Set(value As Integer)
                _editorBlogID = value
            End Set
        End Property

        Protected Overrides Sub FillTopToolbar()
            TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Bold())
            TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Italic())
            TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Copy())
            TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Cut())
            TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Paste())
            TopToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.Redo())
            Dim btn As New AjaxControlToolkit.HTMLEditor.ToolbarButton.MethodButton()
            btn.NormalSrc = "images/upload.png"
            btn.ID = "btnUplaodImg"
            btn.Attributes.Add("onclick", "show();")
            'this method show() is calling from  user control where we add the reference  

        End Sub

        Protected Overrides Sub FillBottomToolbar()
            BottomToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.DesignMode())
            BottomToolbar.Buttons.Add(New AjaxControlToolkit.HTMLEditor.ToolbarButton.PreviewMode())
        End Sub

    End Class

End Namespace

Anyway, if anyone can point out my blunder I'd be very grateful!

Recommended Answers

All 4 Replies

You have actually posted this in the wrong forumn.

There ASP.NET form can be found Here

Ah dang. Can I move it? Doesn't seem to let me.

Soon enough a mod wil come move it for you. Normally takes about 2/3 hours for one to see it.

If you view your page source is the control showing in the HTML? Any part of it at all?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.