WebTextEditor使用服务器端事件InitializeToolBar添加自定义命令

作者:控件中国网   出处:控件中国网   2016-06-16 14:49:41   阅读:6

WebTextEditor是行业内第一款整合了直观地写入、在线拼写检查、上传、多种文本格式化、工具栏,可以帮助开发人员构建复杂的CMS应用程序。下面介绍了如何通过控件提供的 InitializeToolBar服务端事件为WebTextEditor文本编辑框添加自定义命令,具体可以参考下面的代码:
<a href=http://www.componentcn.com/kongjianchanpin/wendangguanli/wenbenbianjikongjian/2014-11-11/501.html target=_blank class=infotextkey>WebTextEditor</a>-heading-img-1.png
1.在InitializeToolBar事件中添加自定义命令
protected void WebTextEditor1_InitializeToolBar(object sender, ISNet.WebUI.WebTextEditor.WebTextEditorToolBarArgs e)
   WebTextEditorToolBar tb = e.GetToolBarByCategory(WebTextEditorToolBarCategory.Standard);  
 
   WebTextEditorToolCommand tbCommand = tb.ToolCommands.CreateNewItem(); 
   tbCommand.Name = "cmdCustomButton"; 
   tbCommand.Text = "Custom Command";  
 
   tb.ToolCommands.Add(tbCommand);
}
2.当点击自定义命令时,客户端执行相应操作
function WebTextEditor1_OnToolBarClick(controlId, command, commandSection)
{   
   var rte = ISGetObject(controlId);    
   switch (command.Name)   
   {       
      case "cmdCustomButton":           
           alert("Custom button clicked");           
           break;   
   }
}
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat