FreeTextBox

The no. 1 free ASP.NET HTML Editor.
Welcome to FreeTextBox Sign in | Join | Help
in Search

Loosing content on post-back

Last post 09-02-2008, 8:25 PM by JJJB. 44 replies.
Page 3 of 3 (45 items)   < Previous 1 2 3
Sort Posts: Previous Next
  •  07-17-2006, 7:51 PM 6931 in reply to 3958

    Re: Loosing content on post-back

    Hi Parrot,   we have a similar issue - works fine on a local machine - as the web and database are on the same box, however when we move to the production servers - we occassionally lose content if the users do not wait until the content has "refreshed" the edit screen ... 

    doesnt help resolve the issue - but hope this helps

  •  10-05-2006, 8:49 PM 7330 in reply to 6931

    Re: Loosing content on post-back

    I had the same problem, I sorted it by adding a text box readonly as part of my design. I use some javascript to set focus to this text box. This forces the user to click into theFTB before entering data.

    this then activates the FTB correctly and all works fine.

     

    Hope this helps someone

  •  10-20-2006, 12:54 PM 7436 in reply to 3872

    Re: Loosing content on post-back

    I'm not sure if you ever got this resolved, but what we have identified is that the textarea form element is disabled until after the initialization is completed so when the form is submitted before initization has completed the form collection does not contain that textarea value (since it is disabled it is not sent in the post) It should be possible to remove that attribute from the textarea.
  •  11-11-2006, 12:20 AM 7556 in reply to 7436

    Re: Loosing content on post-back

    I am using asp.net 1.1 with ftb 3.1.6

    I realized that this error happens when using smartnavigation in my case. I used the following workaround in my page_load: (First set smartNavigation = false)

    Page.RegisterStartupScript("FocusScript", "<script>document.getElementById('" & txtTitle.ClientID & "').focus();</script>")

    Page.RegisterStartupScript("FocusScriptFtb<script>document.getElementById('" & ftbContent.ClientID & "').focus();</script>")

    First I registered The FocusScript to select the first textbox on my form, then set focus on the FTB, this will init the ftb.

    I am working with smartNavigation to make a new workaround

  •  12-08-2006, 4:07 PM 7709 in reply to 7556

    Re: Loosing content on post-back

    Ok, after posting in a new thread about this same issue, hoping to get attention of the developers, it has failed!

    This is obviously sub-par javascript coding, as the FTB.Text value gets updated on my pages, yet the FTB's show BLANK (although they load just fine with correct values on initial page load). If you do this:

    Protected Sub CallBack1_Callback(ByVal sender As Object, ByVal As ComponentArt.Web.UI.CallBackEventArgs) Handles CallBack1.Callback

       Dim ftb1 As FreeTextBoxControls.FreeTextBox = FormView1.FindControl("ftb1")
       FormView1.RenderControl(e.Output)
       ftb1.RenderControl(e.Output)

    End Sub 'CallBack1_Callback

    This makes a WHOLE new control on the page, which still doesn't function, as everything is disabled. I don't mean it renders a new FormView control, it refreshes (DataBind) the FormView control, but it ADDS another FTB to the end of the FormView (not even inside it at this point). I realize the code above is not to be used, but I did this as an experiment. When using a Callback as we (our group), you call RenderControl to Reget the entire control, so it is updated with current information. Previously, when I've had problems with this, I use this code to figure out if the control (FTB in this case) is no longer associated with it's previous ClientID. 100% of the time this is the case. I'm not an expert programmer, but this is a serious issue and should be resolved. I certainly can't justify spending ANY money on this product unless it functions correctly. If anyone has a workaround to this problem, please send it my way, as nothing that has been suggested so far works in this case:

    TreeView on left of page, FormView with FTB on right of page. Click on a category in the TreeView and it uses the ComponentArt Callback to retrieve the FormView (with FTB) with current information. This is all done with ObjectDataSources, it is not SQL or Access data sources. Our code is entirely object-oriented. Whichever DS is used, makes no difference, it's a problem with FTB. But, there has to be a solution! Even writing this post there are problems, I hope these forums aren't using FTB, as it keeps changing my font size when I underline, bold, italicize, etc.

  •  12-21-2006, 4:17 PM 7771 in reply to 7436

    Re: Loosing content on post-back

    BRILLIANT!!!!

    Gene, I read your comment days ago, but I didn't appreciate it. After four solid days of debugging, I found the answer to my lost content. And when I went to post my answer to the forum, I saw your post was already here.

    Folks, Gene's post is at http://freetextbox.com/forums/permalink/4118/7436/ShowThread.aspx#7436

    The problem for me is the following:
     
    Some pages I have with FTB may have very long load times. This can be caused by an external image being loaded or Adsense ads being displayed.

    The Page's onload event doesn't fire until after these images load.

    The FTB Javascript contructor - FTB_FreeTextBox() - isn't called until the page load event fires. So, on these requests with slow loading pages, FTB is not initialized until after everything loads.

    FTB's data is stored in a <textarea> that is used to support the Html tab. This textarea's data is posted back to the server when the page is submitted.

    When FTB is rendered, the text area is always initialized to disabled.

    In the FTB Javascript contructor, if FTB is NOT in readonly mode, the disabled attribute is cleared.
    The problem is if a postback occurs before the onload event fires and before the FTB_FreeTextBox()  function runs.

    On a slow loading page a user may click a button or link that causes a postback before FTB is fully initialized. In this case the <textarea> is still disabled and disabled elements are not posted back to the server. So, the body of the post vanishes!
     

    The solution:

    When FTB is rendered, the textarea should only be disabled if the control is in Readonly mode. This fix requires source code.

    You can also slip in some inline Javascript to enable the text area after FTB is rendered.


    Michael Levy
    Equicast Media
  •  12-28-2006, 5:30 PM 7777 in reply to 7771

    Re: Loosing content on post-back

    You don’t have to update the FTB source. You can patch this by adding a little bit of Javascript that runs while the page is still loading. The trick is you want a line of javascript to be loaded inline immediately after FTB is declared. It should look something like:

     document.getElementById('Unique_Id_of_FTB_Control').disabled = '';

    Here is what I did. I use .Net 1.1 with VB. I have FTB wrapped in a ASCX user control. But that isn’t necessary for a fix like this to work.

    Immediately after the declaration of your FTB control (or its wrapper control), add an <asp:literal> like:

     <asp:Literal ID="litTeContentPatch" Runat="server"/>

    Declare the literal in your code behind (I used VB, but the C# equivalent is easy) :

     Protected litTeContentPatch As System.Web.UI.WebControls.Literal

    Then in your control’s OnLoad handler do something like the following:

     Dim script As String
     Dim teId As String = Me.ClientID
     ' there is a nasty bug in FTB that can cause the body of the text to be lost on post back.
     ' in short the problem is that FTB starts off with its Html Textarea being disabled.
     ' only after the onload event runs is FTB initialized and the disabled flag cleared.
     ' the problm is that on slow loading pages users often click a link before the onload event fires
     ' this patch is hardcoded to enable the text area by inserting inline javascript after FTB is rendered.
     script = "<script language=""javascript"" type=""text/javascript"">" & vbCrLf & _
      " <!-- " & vbCrLf & _
      "   // EQM: patch a bug in FTB by enabling the the Textarea before the onload event." & vbCrLf & _
      "   document.getElementById('" & teId & "_teContent_teContent').disabled = ''; " & vbCrLf & _
      vbCrLf & _
      " // --> " & vbCrLf & _
      " </script>"

    litTeContentPatch.Text = script

    If you are using FTB directly in a page and not wrapped in a user control, the Unique_Id is calculated a bit differently.


    Michael Levy
    Equicast Media
  •  06-08-2007, 12:23 PM 8290 in reply to 7771

    Re: Loosing content on post-back

    Well, here's my question:

    I gave this a go, and in theory it should certainly work; however, I have mine inside of a PlaceHolder, which gets redrawn (and all of its children components) to the browser. As you explained, it comes back disabled. So what I did was also add the literal control and the appropriate javascript. When the RenderControl method is called and the literal control is redrawn, the javascript runs because I can put an alert inside of it. So even though I set the FTB control to disabled = false, it still shows up disabled. All of this happens after the onload event and in the callback event. WHAT'S HAPPENING! I've been debugging for the 3rd day and I'm about to give up. I really like the FTB control, but if its not going to display my data on a callback, I can't use it.

    My assessment is that eventhough I set the FTB controls value to false and confirm that it is, when the PlaceHolder is rendered, the FTB control must lose the value of false again.

    HELP!!!

  •  06-08-2007, 12:29 PM 8291 in reply to 7709

    Re: Loosing content on post-back

    EXACTLY! I'm having the exact same problem. I posted in response to a patch someone created using a literal control, but it doesn't work. This is so frustrating! You know, to be honest. You wonder why this control is virutally free and so inexpensive, and its because it has issues. For a simple user, it will probably work. But for advanced users, its a NO GO!

    Sincerely,

    FRUSTRATED

  •  06-09-2007, 1:14 PM 8296 in reply to 8291

    Re: Loosing content on post-back

    Sorry, I don't know how to fix your problem. The fix I posted on 12/29/06 has worked for me on wildvoice.com. We have a pretty complex hierarchy of dynamically generated controls that are inserted into placeholders. That snippit of javascript to enable the textarea has fixed all the issues I was having with empty posts.

    Are you sure you are correct ID for getElementById()? Did you view the Html source to confirm?


    Michael Levy
    Equicast Media
  •  06-20-2007, 11:17 AM 8332 in reply to 8290

    Re: Loosing content on post-back

    HI,

    I had the same problem. try this one.

    <%@PageLanguage="C#"MasterPageFile="~/Users/MyPage.master"AutoEventWireup="true"CodeFile="AddBlog.aspx.cs"Inherits="Users_AddBlog"Title="Untitled Page"%>, here you are missing this ValidateRequest="false"

    so your first line in the html of the page must look smth like this

    <%@PageLanguage="C#"MasterPageFile="~/Users/MyPage.master"AutoEventWireup="true"CodeFile="AddBlog.aspx.cs"Inherits="Users_AddBlog"Title="Untitled Page" ValidateRequest="false" %>.

    You can see that this works even if you use master pages. Hope someone will find this usefull.

  •  08-31-2007, 6:00 AM 8506 in reply to 7556

    Re: Loosing content on post-back

    Hi,

    My FTB was working fine, and then this error came up.

    Well, I've traced back my changes, and realised that I've started using SmartNavigation. So I've disabled SmartNavigation and the erro desapear.

    The solution is: On the Page_Load event, just disable the SmartNavigation for this page, like that:

    VB: Me.SmartNavigation = true
    C#: this.SmartNavigation = true;

    Now it works perfectly!

  •  04-17-2008, 8:51 AM 9088 in reply to 3660

    Re: Loosing content on post-back

  •  04-17-2008, 9:13 AM 9089 in reply to 9088

    Re: Loosing content on post-back

    e6matt:

    DONT you think YOUR taking Internet forum posting TO seriously?

     

    PS. Is there a FurtherFarther.com too?


    Michael Levy
    Equicast Media
  •  09-02-2008, 8:25 PM 9414 in reply to 3660

    Re: Loosing content on post-back

    this and other issues in this thread sound similar to a problem i just solved.  i have a freetextbox inside a datalist, which was inside a panel which is collapsed by default.  when my page loaded, none of my other controls (buttons, drop down lists, etc.) would fire until the freetextbox's panel was shown, and thus showing the freetextbox.

    i got around this by setting the freetextbox's readonly attribute to true, and then setting this attribute to false in the prerender event.

    <FTB:FreeTextBox ID="FreeTextBox_ID" runat="server" ReadOnly="true"
                                             OnPreRender="FreeTextBox_ID_OnPreRender">
        protected void FreeTextBox_ID_OnPreRender(Object sender, EventArgs e)
        {
            this.FreeTextBox_ID.ReadOnly = false;
        }

    hope that helps someone.  i just stumbled upon it by playing the freetextbox properties...got the idea from this thread.
Page 3 of 3 (45 items)   < Previous 1 2 3
View as RSS news feed in XML
www.freetextbox.com