Re: Capture New and Delete Events

  •  05-15-2009, 4:47 AM

    Re: Capture New and Delete Events

    Hi robinsong,
     
    Try this example:
     
    ------------------------------------------------------------------------->
     

    <%@ Page Language="VB" %>

    <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <script runat="server">
        Public Sub newCilck()
            label1.Text = "New"
        End Sub
        Public Sub deleteClick()
            label1.Text = "Delete"
        End Sub

        Protected Sub btnNew_Click(ByVal sender As Object, ByVal e As EventArgs)
            newCilck()
        End Sub

        Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As EventArgs)
            deleteClick()
        End Sub
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <CE:Editor ID="Editor1" runat="server">
            </CE:Editor>
            <asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" Style="visibility: hidden" />
            <asp:Button ID="btnDelete" runat="server" Style="visibility: hidden" OnClick="btnDelete_Click" />
            <asp:Label ID="label1" runat="server"></asp:Label>

            <script language="JavaScript" type="text/javascript">
      function CuteEditor_OnCommand(editor,command,ui,value)
      {
      
       if(command=="New")
       {
         var btnNew=document.getElementById("<%= btnNew.ClientID %>").click();
         return true;
       }
       if(command=="Delete")
       {
         var btnDelete=document.getElementById("<%= btnDelete.ClientID %>").click();
        return true;
       }
      }
            </script>

        </form>
    </body>
    </html>

     ------------------------------------------------------------------------->
     
    Regards,
     
    Ken
View Complete Thread