Rich Text Editor for ASP.NET Web Forms - How to automatically change the availability of a custom Save button
This example demonstrates how to create a custom Save button that is disabled when the document has no changes and is enabled when the document is changed.
- Create a function where you call the FileSaveCommand.getState method to get the state of the default Save button.
- Apply the availability state of the default button to your custom Save button.
function checkOnChanges() {
var currectState = richEdit.commands.fileSave.getState();
var saveButton = richEdit.GetRibbon().GetItemByName("Save");
saveButton.SetEnabled(currectState.enabled);
}
- Call this function in DocumentChanged and EndCallback event handlers.
function onDocumentChanged(s, e) {
checkOnChanges();
}
function onEndCallback(s, e){
checkOnChanges();
}
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
- JavaScript.js (VB: JavaScript.js)
(you will be redirected to DevExpress.com to submit your response)