Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

FreeTextBox disabled in Panel

Posted on 2008-11-12
20
Medium Priority
?
2,319 Views
Last Modified: 2012-05-05
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.  
0
Comment
Question by:azyet24
  • 10
  • 9
20 Comments
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22947078
Are you taking about UpdatePanel? AJAX?
Harry
0
 

Author Comment

by:azyet24
ID: 22947101
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
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22947114
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:azyet24
ID: 22947122
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
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22947137
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
 

Author Comment

by:azyet24
ID: 22947153
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
 
LVL 3

Expert Comment

by:Rupesh P
ID: 22947168
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
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22947183
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
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22947188
Rest you can try using JavaScript as rupeshIndia said to avoid post back for freetextbox visibility.

Harry
0
 

Author Comment

by:azyet24
ID: 22947252
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
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22947320
Try this
function displayPnl()
    {
     
            document.getElementById("<%=pnlBuilders.ClientID%>").style.display = "block";
       
    }
0
 

Author Comment

by:azyet24
ID: 22947372
Unfortunatly no.  No errors, just the editor is not enabled.
0
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22947396
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
 

Author Comment

by:azyet24
ID: 22950627
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
 

Author Comment

by:azyet24
ID: 22951590
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
 

Author Comment

by:azyet24
ID: 22951718
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
 
LVL 5

Expert Comment

by:harwantgrewal
ID: 22955001
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
 

Author Comment

by:azyet24
ID: 22956248
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
 
LVL 5

Accepted Solution

by:
harwantgrewal earned 2000 total points
ID: 22956519
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
 

Author Comment

by:azyet24
ID: 22956569
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question