Get a serverside reference to the Save button

Last post 02-12-2009, 4:43 PM by Adam. 4 replies.
Sort Posts: Previous Next
  •  02-12-2009, 1:37 PM 48688

    Get a serverside reference to the Save button

    Hi Adam,
     
    I would like to fire a clientside javascript function when the user clicks the Save button.
    I know the documentation has examples of this but in my case this is not working. This is probably due to the way I have overriden the CE control so that users can dynamically add the CE control through webparts.
     
    Bascially I would like to get a ref to the save button then simply add an an onclick attribute.
     
    Something like...
     
    WebControl btSave = (WebControl)this._tb.Findcontrol("Save");
    btSave.Attributes.Add("onclick", "firemyfunction()");
     
    Trouble is I dont know the type of the Save button to look for?
     
    Paul.
    Filed under:
  •  02-12-2009, 2:38 PM 48705 in reply to 48688

    Re: Get a serverside reference to the Save button

    Paul,
     
    1.
     
    How to capture the save button click event?

    How to capture the SAVE button click event?( C# | VB )

    This example demonstrates how to capture the SAVE button click event by using client-side code and server-side code.

     
    Please check this example. The source code of this example is included in the download package.
     
    2. use CuteEditor_OnCommand

    Click the InsertEmotion button of the following example.


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  02-12-2009, 2:39 PM 48706 in reply to 48688

    Re: Get a serverside reference to the Save button

    Another way to solve my probelm would be to add my own custom button with a post back. Trouble is I can either have a button with no image (postback works) or an ImageButton with no post back? Please help I have been trying to solve this for hours.

                Button btSave = new Button();                        // Works but cant have image
         or    ImageButton btSave = new ImageButton();     // Has image (no hover) but postback does not work (does not save data)
                btSave.ID = "btSave";
                btSave.CommandName = "Save";
                btSave.ImageAlign = ImageAlign.AbsMiddle;
                btSave.CausesValidation = false;
                btSave.ToolTip = "Save";
                btSave.CssClass = "ButtonAsImage";
                btSave.OnClientClick = "return SavingWP()";
                btSave.ImageUrl = "/CS/RTFEditor/Images/Save.gif";
                this._tb.InsertToolControl(1, "MySave", btSave); 

    Filed under:
  •  02-12-2009, 2:53 PM 48711 in reply to 48705

    Re: Get a serverside reference to the Save button

    Hi Adam,
     
    The function...
     
      function CuteEditor_OnCommand(editor,command,ui,value)
      {
      
      alert("Got here");
      
      } 
     
    is not firing when I click the save button?
     
  •  02-12-2009, 4:43 PM 48720 in reply to 48711

    Re: Get a serverside reference to the Save button

    Please check the source code of the following example:
     
    How to capture the save button click event?

    How to capture the SAVE button click event?( C# | VB )

    This example demonstrates how to capture the SAVE button click event by using client-side code and server-side code.


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML