Issue with ext:button postback vs ASP.Button postback and CkEditor

  1. #1

    Issue with ext:button postback vs ASP.Button postback and CkEditor

    Hi,

    I am trying to use the CKEditor in an application I am building and have run into a problem which I am sure is easy to solve but I am not sure where or how.

    I have web page which has a popup window inside of which sits the ckeditor, when I click a button on the page I want the window to open set the text in the editor to some text from a database to allow the user to then edit this.

    If the button I use is an ASP.net button this all works fine, however if it is an ext.net button the window opens shows the grid but no text is displayed.

    I have created a very simple app to reproduce this below:

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="test.WebForm1" validateRequest="false" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     <%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
      <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
         
    
         <ext:ResourceManager runat="server" ID="rm1"></ext:ResourceManager>
        <div>
    
       
            
                <asp:Panel runat="server" ID="pnl1" Height="400" Width="300" Region="Center" >
                <asp:Button runat="server" ID="x1"/>
                     
                <ext:Button runat="server" id="x2">
                    <DirectEvents>
                        <Click OnEvent="x2_Clcik"></Click>
                    </DirectEvents>
                </ext:Button>
          
                <CKEditor:CKEditorControl ID="ckedit" runat ="server"></CKEditor:CKEditorControl>    
           
        
        </asp:Panel>
            
            
          
          <p></p>
        <div>
        
        <ext:panel runat ="server" ID="wnd1" >
            <Content>
            <CKEditor:CKEditorControl ID="CKEditorControl1" runat ="server" Height="400"></CKEditor:CKEditorControl>    
            
            </Content>
        
        </ext:panel>
     
        </div>
        </div>
        </form>
    </body>
    </html>
    And Code Behind

    Public Class WebForm1
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            If Not IsPostBack Then
                ' wnd1.Visible = False
                wnd1.Hide()
    
                Dim x As String = "<UL><LI>Aircraft Leasing</LI><UL><LI><FONT face=Arial>some text linked t the leasing of aircraft</FONT></LI></UL></UL><P><FONT face=Arial>skl;dfjksj </FONT></P>"
                ckedit.Text = x
            End If
    
        End Sub
       
    
        Private Sub WebForm1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
            Page.RegisterRequiresPostBack(CKEditorControl1)
        End Sub
        Public Sub x2_Clcik()
    
            wnd1.Show()
            ckedit.Text = "Validate incoming process information, engage with client to perform quality assurance and complete analysis"
    
            Dim x As String = "<UL><LI>Aircraft Leasing</LI><UL><LI><FONT face=Arial>some text linked t the leasing of aircraft</FONT></LI></UL></UL><P><FONT face=Arial>skl;dfjksj </FONT></P>"
            CKEditorControl1.Text = ckedit.Text
    
            CKEditorControl1.AutoUpdateElement = True
        End Sub
        Private Sub x1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles x1.Click
            'wnd1.Visible = True
            wnd1.Show()
    
            ckedit.Text = "Validate incoming   process information, engage with  client to perform quality assurance and complete analysis"
    
            Dim x As String = "<UL><LI>Aircraft Leasing</LI><UL><LI><FONT face=Arial>some text linked t the leasing of aircraft</FONT></LI></UL></UL><P><FONT face=Arial>skl;dfjksj </FONT></P>"
            CKEditorControl1.Text = ckedit.Text
        End Sub
    End Class
  2. #2
    Hi,

    Well, I think that CKEditor knows no about DirectEvent and this code:
    CKEditorControl1.Text = ckedit.Text
    doesn't make any sense during DirectEvent.

    You can call js function during DirectEvent to set up a text for CKEditor:
    X.JS.Call("setEditorText", ckedit.ClientID, "some text");
    
    var setEditorText = function (editorClientId, text) {
      // set the text for the editor 
    };

Similar Threads

  1. Button postback with confirmation
    By zach in forum Examples and Extras
    Replies: 2
    Last Post: Sep 28, 2011, 3:53 PM
  2. Issue with postback
    By Amar in forum 1.x Help
    Replies: 2
    Last Post: Aug 05, 2010, 6:40 PM
  3. Postback Refresh issue
    By accessyourbiz in forum 1.x Help
    Replies: 2
    Last Post: Jul 23, 2010, 4:51 PM
  4. [CLOSED] [1.0] Ext.Button cause postback?
    By alliedwallet.com in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 30, 2010, 4:52 PM
  5. [CLOSED] Click on button - no postback
    By george in forum 1.x Help
    Replies: 3
    Last Post: Sep 08, 2008, 1:02 PM

Tags for this Thread

Posting Permissions