.Net图表开发工具JDash.Net创建dashboard
步骤一
使用项目参考窗口添加参考JDash.dll,我们可以在安装目录找到(默认为C:\Program Files\Kalitte\JDash\Bin directory)。
步骤二
添加新Asp.Net页面到你的项目中,例如:ManageDashboards.aspx。使用该页可以创建、浏览dashboards。
步骤三
在页面拖动Asp.Net Textbox、 Button、Repeater控件。该页列出现阶段的dashboards,并允许用户点击dashboards查看。具体可以看下面的代码:
<form id="form1" runat="server"> <div> <asp:TextBox ID="dashTitle" runat="server"></asp:TextBox> <asp:Button ID="createBtn" runat="server" Text="Create Dashboard" OnClick="createBtn_Click" /><br /> <asp:Label Text="Dashboards" runat="server" /><br /> <asp:Repeater runat="server" id="listRepeater"> <ItemTemplate> <asp:HyperLink runat="server" Target="_blank" Text='<%# Eval("title") %>' NavigateUrl='<%# string.Format("/DisplayDashboard.aspx?id={0}", Eval("Id")) %>'></asp:HyperLink> <br /> </ItemTemplate> </asp:Repeater> </div> </form>
步骤四
页面加载成寻绑定当前dashboards至repeater。代码如下:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using JDash; using JDash.Models; ... protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { listRepeater.DataSource = JDashManager.Provider.SearchDashboards().data; listRepeater.DataBind(); } }
步骤五
点击处理程序按钮,创建新dashboard,代码如下:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using JDash; using JDash.Models; ... protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { listRepeater.DataSource = JDashManager.Provider.SearchDashboards().data; listRepeater.DataBind(); } }
原文转自:慧都控件网,原作者:走猫步的鱼,地址:http://www.evget. com/article/2013/11/25/20103.html