FreeTextBox disabled in Panel

I have a FreeTextBox in a panel that is set to visible = false when the page loads.  I have a lnkbutton that when clicked will set visibility = true for this panel.  When the panel is visible, the FreeTextBox displays, but you can not type anything nor select any of the controls.  When I look at the page source, I do not even see that the editor is initialized.  However, if I place the editor outside the panel it works perfectly.  
azyet24Asked:
Who is Participating?
 
harwantgrewalConnect With a Mentor Commented:
I did at test and it worked the only thing I did change is no casting as its already known type if you have referenced the FreeTextBox dll

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
IF IsPostBack THEN
        FreeTextBox1.Text = "Hello World"
END IF
    End Sub


PS: I am not a VB programmer I hope I have written if statement correctly :)
0
 
harwantgrewalCommented:
Are you taking about UpdatePanel? AJAX?
Harry
0
 
azyet24Author Commented:
Yes this is on a page that has an updatepanel, AJAX, but it works fine as long as I don't put it inside the asp.net panel <asp:panel> with visibile = false.  If I change visible = true and allow this to be shown when the page loads, then everything works fine.  There is something about the editor not initializing when I set visibility = true on the linkbutton selection.
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
harwantgrewalCommented:
But that asp panel is in UpdatePanel?

As AJAX is a big trouble with Javascript components one of them is any WYSIWYG editor. Try removing all ajax and see if it works.

Harry
0
 
azyet24Author Commented:
What doesn't make sense is that it DOES work fine in the update panel.  The only time it does not work is if the panel is set to visibility = false and then true.  I don't understand that.
0
 
harwantgrewalCommented:
Yes I do understand it work fine with on the first time of the page load you make the visibility true.
When you click the button to make the visibility true from false it does a postback in updatepanel?
If yes the can you try removing update panel and try if the button click works fine?

Harry
0
 
azyet24Author Commented:
Ok, yes when I removed all the AJAX then when the panel is set to visible = true from the linkbutton the editor works fine.  So how can this work with the AJAX?
0
 
Rupesh PCommented:
can u try to avoid the visibility by adding style.
  ctrl.Style.Add("display", "none");

To make the ctrl visible
.Style.Add("display", "block");

0
 
harwantgrewalCommented:
Hi azyet24

Belive me AJAX is the biggest pain I ever had and after 8 months we scraped it as its making lot of troubles to us you just came across one. We did find couple of fixes to many of our problems with AJAX but finally I belived that its not doing anything good apart of uguly postback. We use AJAX in the those pages where there is no other complex javascripts, and I would suggest you that. If you still looking for the solution I am sorry every problem has its own solution in my case :)

Harry
0
 
harwantgrewalCommented:
Rest you can try using JavaScript as rupeshIndia said to avoid post back for freetextbox visibility.

Harry
0
 
azyet24Author Commented:
I added this:

    function displayPnl()
    {
     
            document.getElementById("['ctl00_ContentPlaceHolder1_txtbuilders'] ").style.display = "block";
       
    }



Then I added to the linkbutton:
<asp:LinkButton ID="lbBuilders" OnClientClick ="displayPnl();" PostBack="False" runat="server">Builders</asp:LinkButton>

in page load I added:
 pnlBuilders.Style.Add("display", "none")

When I click the linkbutton it still does not enable the textbox.
0
 
harwantgrewalCommented:
Try this
function displayPnl()
    {
     
            document.getElementById("<%=pnlBuilders.ClientID%>").style.display = "block";
       
    }
0
 
azyet24Author Commented:
Unfortunatly no.  No errors, just the editor is not enabled.
0
 
harwantgrewalCommented:
Thats what I told every problem has it own solution. I would say it just a hit and trial best bet not to use AJAX.

Harry
0
 
azyet24Author Commented:
I gave up on the ajax approach.  Mind if I ask another question regarding the freetextbox?  I am getting an error message from my query saying that it can't find the object.  Here's how I'm trying to fill the textbox.

Code-behind:
Dim FTB_builder As New FreeTextBoxControls.FreeTextBox

FTB_builder = CType(Me.FindControl("ctl00_ContentPlaceHolder1_txtbuilder"), FreeTextBoxControls.FreeTextBox)

while read()
FTB_builder.Text = objRdr("builder")
end while


aspx page:
<FTB:FreeTextBox id="txtbuilder"
                                                   ImageGalleryPath="~/images/userphotos/" width="700px" height="400px"  
                                                   ToolbarLayout="paragraphmenu,fontsizesmenu;bold,italic,underline|
                                                     FontFacesMenu, FontSizesMenu, FontForeColorsMenu,
                                                     FontForeColorPicker, FontBackColorsMenu, FontBackColorPicker, Bold, Italic, Underline,
                                                     Superscript, Subscript|, InsertImageFromGallery, CreateLink, Unlink,
                                                     RemoveFormat, JustifyLeft, JustifyRight, JustifyCenter, JustifyFull|
                                                     BulletedList, NumberedList, Indent, Outdent|
                                                     Cut, Copy, Paste, Delete, Undo, Redo, Print, Save,
                                                     ieSpellCheck, StyleMenu, SymbolsMenu, InsertHtmlMenu, InsertRule, InsertDate,
                                                     InsertTime, WordClean, InsertImage, InsertTable, EditTable|
                                                     InsertTableRowBefore,  InsertTableRowAfter, DeleteTableRow, InsertTableColumnBefore, InsertTableColumnAfter,
                                                     DeleteTableColumn, InsertForm, InsertForm, InsertTextBox, InsertTextArea,
                                                     InsertRadioButton, InsertCheckBox, InsertDropDownList, InsertButton, InsertDiv,
                                                     InsertImageFromGallery, Preview, SelectAll, EditStyle"
                                                   runat="Server" />
0
 
azyet24Author Commented:
I change the page so that it is not code behind and put all the code in one aspx page.  I have another site where I've used this with no problems.  The only difference between the two (that I can think of) is that this one uses a master page and the other one didn't.  
0
 
azyet24Author Commented:
Yes, the master page is the issue.  I created another page that is not code behind nor has masterpage and the text loads fine in the editor.  so now to get the editor found using master page.  Any thoughts?
0
 
harwantgrewalCommented:
Hi Azyet

I can really help without having the exact error message plus I need the code where you are trying to access this object and which get null value.

Harry
0
 
azyet24Author Commented:
Ok, I created a test masterpage and test page and I am able to replicate the issue with limited code.  Attached is the complete code from all pages.
text.aspx.vb
Partial Class test
    Inherits System.Web.UI.Page
    Dim FTB As New FreeTextBoxControls.FreeTextBox
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        FTB = CType(Me.FindControl("FreeTextBox1"), FreeTextBoxControls.FreeTextBox)
        FTB.Text = "Hello World"
    End Sub
End Class
 
 
test.aspx
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
  <FTB:FreeTextBox id="FreeTextBox1" ImageGalleryPath="~/images/userphotos/" width="700px" height="400px"   
       ToolbarLayout="paragraphmenu,fontsizesmenu;bold,italic,underline|
        FontFacesMenu, FontSizesMenu, FontForeColorsMenu, 
 FontForeColorPicker, FontBackColorsMenu, FontBackColorPicker, Bold, Italic, Underline,
 Superscript, Subscript|, InsertImageFromGallery, CreateLink, Unlink, 
 RemoveFormat, JustifyLeft, JustifyRight, JustifyCenter, JustifyFull|
 BulletedList, NumberedList, Indent, Outdent| 
 Cut, Copy, Paste, Delete, Undo, Redo, Print, Save, 
 ieSpellCheck, StyleMenu, SymbolsMenu, InsertHtmlMenu, InsertRule, InsertDate, 
 InsertTime, WordClean, InsertImage, InsertTable, EditTable|
 InsertTableRowBefore,  InsertTableRowAfter, DeleteTableRow, InsertTableColumnBefore, InsertTableColumnAfter, 
 DeleteTableColumn, InsertForm, InsertForm, InsertTextBox, InsertTextArea, 
 InsertRadioButton, InsertCheckBox, InsertDropDownList, InsertButton, InsertDiv, 
 InsertImageFromGallery, Preview, SelectAll, EditStyle"
runat="Server" />
</asp:Content>
 
 
 
Masterpage.master
<%@ Master Language="VB" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
 
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

Open in new window

0
 
azyet24Author Commented:
You've got to be kidding me...that easy.  Well in another site I wasn't using masterpages and was using an older version of freetextbox and had to cast it.  Well, it is working now and I thank you much.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.