原創|使用教程|編輯:龔雪|2013-11-14 09:33:10.000|閱讀 655 次
概述:首先,我們來回顧下前兩章講的內容 :第一章講了使用JDash.Net添加組件、第二章講了設置SQL Server Providers。下面將向大家介紹如何使用Dashlet編輯器創建dashlet。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
首先,我們來回顧下前兩章講的內容 :第一章講了使用JDash.Net添加組件、第二章講了設置SQL Server Providers。下面將向大家介紹如何使用Dashlet編輯器創建dashlet。
使用解決方案瀏覽器窗口,選擇項目,然后右鍵。創建一個名為JDash的庫,并在里面創建Dashlets庫。我們建議大家為庫選擇另外的名字命名。
選擇Dashlets庫,右鍵找到" Add New Item"對話框,將 HtmlDashlet.ascx和HtmlDashletEditor.ascx 兩個Asp.Net用戶組件添加到Dashlets庫。
按自己的喜好布置這些組件。本文教程講布置Html Dashlet。
打開HtmlDashlet.ascx并拖拽Asp.Net Literal組件。
按照下面的代碼,布置Dashlet。此步驟會讓用戶獲得html配置值集并渲染它。
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using JDash.WebForms; namespace HelloWorld.JDash.Dashlets { public partial class HtmlDashlet : System.Web.UI.UserControl { private DashletContext context; [JEventHandler(JEvent.InitContext)] public void InitContext(object sender, JEventArgs args) { this.context = args.Event.Parameters.Get<DashletContext>("context"); } public override void DataBind() { var htmlString = context.Model.config.Get<string>("html", ""); htmlLit.Text = htmlString; context.RenderDashlet(); base.DataBind(); } } }
打開HtmlDashletEditor.ascx。使用工具箱、 JDash標簽,拖拽DashletTitleEditor和DashletStylesList,最后添加Textbox。HtmlDashletEditor.ascx應該如下設置:
<jdash:DashletTitleEditor ID="DashletTitleEditor1" runat="server" /> <jdash:DashletStylesList ID="DashletStylesList1" runat="server" /> <asp:TextBox ID="htmlInput" runat="server" Rows="5" TextMode="MultiLine"> </asp:TextBox>
布置Dashlet編輯器:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using JDash.WebForms; namespace HelloWorld.JDash.Dashlets { public partial class HtmlDashletEditor : System.Web.UI.UserControl { DashletContext context = null; public override void DataBind() { htmlInput.Text = context.Model.config.Get<string>("html", ""); base.DataBind(); } [JEventHandler(JEvent.InitContext)] public void InitContext(object sender, JEventArgs args) { this.context = args.Event.Parameters.Get<DashletContext>("context"); } [JEventHandler(JEvent.ValidateDashletEditor)] public void ValidateDashletEditor(object sender, JEventArgs args) { context.Model.config["html"] = htmlInput.Text; context.SaveModel(); context.DashletControl.DataBind(); } } }
注冊Dashlet。選擇ResourceManager。使用智能標簽組件打開Management Portal,這是一個定義Dashlet的應用程序。
點擊" Dashlet Modules",創建一個新的。下圖示例創建了:標題、用戶組件路徑、編輯組件路徑。
體驗版免費下載:JDash.Net
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網