原創(chuàng)|使用教程|編輯:龔雪|2013-11-14 09:33:10.000|閱讀 655 次
概述:首先,我們來(lái)回顧下前兩章講的內(nèi)容 :第一章講了使用JDash.Net添加組件、第二章講了設(shè)置SQL Server Providers。下面將向大家介紹如何使用Dashlet編輯器創(chuàng)建dashlet。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
相關(guān)鏈接:
首先,我們來(lái)回顧下前兩章講的內(nèi)容 :第一章講了使用JDash.Net添加組件、第二章講了設(shè)置SQL Server Providers。下面將向大家介紹如何使用Dashlet編輯器創(chuàng)建dashlet。
使用解決方案瀏覽器窗口,選擇項(xiàng)目,然后右鍵。創(chuàng)建一個(gè)名為JDash的庫(kù),并在里面創(chuàng)建Dashlets庫(kù)。我們建議大家為庫(kù)選擇另外的名字命名。
選擇Dashlets庫(kù),右鍵找到" Add New Item"對(duì)話(huà)框,將 HtmlDashlet.ascx和HtmlDashletEditor.ascx 兩個(gè)Asp.Net用戶(hù)組件添加到Dashlets庫(kù)。
按自己的喜好布置這些組件。本文教程講布置Html Dashlet。
打開(kāi)HtmlDashlet.ascx并拖拽Asp.Net Literal組件。
按照下面的代碼,布置Dashlet。此步驟會(huì)讓用戶(hù)獲得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(); } } }
打開(kāi)HtmlDashletEditor.ascx。使用工具箱、 JDash標(biāo)簽,拖拽DashletTitleEditor和DashletStylesList,最后添加Textbox。HtmlDashletEditor.ascx應(yīng)該如下設(shè)置:
<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(); } } }
注冊(cè)Dashlet。選擇ResourceManager。使用智能標(biāo)簽組件打開(kāi)Management Portal,這是一個(gè)定義Dashlet的應(yīng)用程序。
點(diǎn)擊" Dashlet Modules",創(chuàng)建一個(gè)新的。下圖示例創(chuàng)建了:標(biāo)題、用戶(hù)組件路徑、編輯組件路徑。
體驗(yàn)版免費(fèi)下載:JDash.Net
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)