Spotting a save button postback

Last post 09-01-2004, 6:25 PM by dhills. 2 replies.
Sort Posts: Previous Next
  •  08-26-2004, 6:08 AM 1617

    Spotting a save button postback

    I imagine this is pretty simple but couldn't see how to do it from the examples and some of the old topics on the subject.

     
    I have enabled the save button in the editor but I have other buttons on the page and they all generate a postback.  How do I determine that the postback has been raised by the save button and not one of my other buttons?
     
    Thanks
  •  08-27-2004, 6:23 AM 1630 in reply to 1617

    Re: Spotting a save button postback

    Nevermind, I ended up creating my own copy of the button and used the __doPostBack javascript method to call my other save button's click method.

     

    For anyone that wishes to do the same thing:

     

    Dim Image1 As New System.Web.UI.WebControls.Image

    Image1.ID = "SaveEditorContent"

    Image1.ToolTip = "Save"

    Image1.ImageUrl = HttpContext.Current.Request.ApplicationPath + /CuteEditor_files/Themes/OfficeXP/save.gif"

    Image1.CssClass = "button"

    Image1.Attributes.Add("onclick", GetPostBackEventReference(btnSave))

    Image1.Attributes.Add("type", "btn")

    Editor1.RegisterCustomButton(Image1)

     

    Then you just need to instantiate the real btnSave in your page somewhere and then you'll be able to fire its click method.  I tried changing the Image1.ID to "btnSave" instead so that I wouldn't need to have another btnSave but when I did that, the editor just rejected my button and didn't display it.

  •  09-01-2004, 6:25 PM 1680 in reply to 1617

    Re: Spotting a save button postback

    the 'save' button's default onClick is:

     
    onclick="__doPostBack('rich_text_box_name','');
     
    So, one way to respond to the save click event is to put a
     
    rich_text_box_name_TextChanged   event in the code. Respond accordingly.
     
    Doug
View as RSS news feed in XML