FineUI(ExtAspnet),EXT.NET都是已经封装好了的组件,从工具箱里面引用后,直接从工具栏里面拖拉控件就可以用了.
但是不用这些组件进行开发的话,而直接用纯EXTJS的话,是不是得每次在页面中进行JS的引用呢?
比如:
<script src="lib/extjs/adapter/ext/ext‐base.js"></script> <script src="lib/extjs/ext‐all‐debug.js"></script>
这样会不会太麻烦了呢,而且相关控件的代码也要从例子中复制过来啊?小弟摸索了几天,始终无法入门,请求大家能够指点一下怎样入门,不胜感激!~~~
但是不用这些组件进行开发的话,而直接用纯EXTJS的话,是不是得每次在页面中进行JS的引用呢?
比如:
<script src="lib/extjs/adapter/ext/ext‐base.js"></script> <script src="lib/extjs/ext‐all‐debug.js"></script>
这样会不会太麻烦了呢,而且相关控件的代码也要从例子中复制过来啊?小弟摸索了几天,始终无法入门,请求大家能够指点一下怎样入门,不胜感激!~~~
解决方案 »
- ClientScript.RegisterStartupScript 刷新页面的问题
- C#中SqlDataSource如何获得多个DataSet?
- 控件的Text属性问题
- 关于gridview绑定两个数据源的分页问题
- 把DATAGRID的內容導出到EXCEL的函數.遇到一個問題.就是如果數據為1-10,6-23等,EXCEL打開後就自動認成了日期型的數據,比如"1月10日".有辦
- 求解,关于这个小问题,我有点糊涂了。。。。50分解决这个问题
- 高手请进
- 客户端调用服务器端事件的怪异问题
- [读书网]刚刚升级.net完成,请发表评论
- 数据检索的问题
- 请教下在EF 环境下用 easyui tree
- EXTJS的使用方式问题,求指点
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Web;
using System.Web.Caching;
using System.Web.UI;[assembly: WebResource("OpenFlashChart.open-flash-chart.swf", "application/x-shockwave-flash")]
[assembly: WebResource("OpenFlashChart.swfobject.js", "text/javascript")]
[assembly: WebResource("OpenFlashChart.backImg.jpg", "image/jpg")]
[assembly: WebResource("OpenFlashChart.OpenFlashChartControl.bmp", "image/bmp")]namespace OpenFlashChart
{
[System.Drawing.ToolboxBitmap(typeof(OpenFlashChart)), Designer(typeof(ChartControlDesigner)), Description("Chart control for open flash chart"), ToolboxData("<{0}:OpenFlashChartControl runat=\"server\" ></{0}:OpenFlashChartControl>")]
public class OpenFlashChartControl : Control
{
private string width;
private string height;
private string externalSWFfile;
private string externalSWFObjectFile;
private string loadingmsg;
private OpenFlashChart chart;
private string chart_json;
private bool _enableCache;
/*
public Page Parent
{
get
{
return this.Page;
}
}*/
/// <summary>
/// Used to hold internal chart
/// </summary>
public OpenFlashChart Chart
{
get
{
return chart;
}
set
{
chart = value;
chart_json = value.ToString();
ViewState["chart_json"] = chart_json;
}
}
private string ChartJson
{
get
{
if (ViewState["chart_json"] != null)
return ViewState["chart_json"].ToString();
return chart_json;
}
}
private string datafile; [DefaultValue("600px")]
[Category("Appearance")]
[PersistenceMode(PersistenceMode.Attribute)]
[Description("宽")]
public string Width
{
get
{
width = "600px";
if (this.ViewState["width"] != null)
{
width = this.ViewState["width"].ToString();
}
return width;
}
set
{
if (!value.EndsWith("%") && !value.EndsWith("px"))
value = value + "px";
this.ViewState["width"] = value;
width = value;
}
}
[DefaultValue("300px")]
[Category("Appearance")]
[PersistenceMode(PersistenceMode.Attribute)]
[Description("高")]
public string Height
{
get
{
height = "300px";
if (this.ViewState["height"] != null)
{
height = this.ViewState["height"].ToString();
}
return height;
}
set
{
if (!value.EndsWith("%") && !value.EndsWith("px"))
value = value + "px";
this.ViewState["height"] = value;
height = value;
}
} [Category("Appearance")]
[PersistenceMode(PersistenceMode.Attribute)]
[Description("指定Open Flash Chart路径")]
public string ExternalSWFfile
{
get
{
if (this.ViewState["externalswffile"] != null)
{
externalSWFfile = this.ViewState["externalswffile"].ToString();
}
if (!string.IsNullOrEmpty(externalSWFfile))
{
if (externalSWFfile.StartsWith("~"))
{
externalSWFfile = this.ResolveUrl(externalSWFfile);
}
}
return externalSWFfile;
}
set
{
this.ViewState["externalswffile"] = value.Trim();
externalSWFfile = value.Trim();
}
}
[Category("Appearance")]
[PersistenceMode(PersistenceMode.Attribute)]
[Description("指定SWFObject路径")]
public string ExternalSWFObjectFile
{
get
{
if (this.ViewState["externalswfobjectfile"] != null)
{
externalSWFObjectFile = this.ViewState["externalswfobjectfile"].ToString();
}
if (!string.IsNullOrEmpty(externalSWFObjectFile))
{
if (externalSWFObjectFile.StartsWith("~"))
{
externalSWFObjectFile = this.ResolveUrl(externalSWFObjectFile);
}
}
return externalSWFObjectFile;
}
set
{
this.ViewState["externalswfobjectfile"] = value.Trim();
externalSWFObjectFile = value.Trim();
}
} [Description("数据源文件(Json格式)")]
public string DataFile
{
get
{
if (this.ViewState["datafile"] != null)
{
datafile = this.ViewState["datafile"].ToString();
}
if (!string.IsNullOrEmpty(datafile))
{
if (datafile.StartsWith("~"))
{
datafile = this.ResolveUrl(datafile);
}
} return datafile;
}
set
{
this.ViewState["datafile"] = value;
datafile = value;
}
} public string LoadingMsg
{
get { return loadingmsg; }
set { loadingmsg = value; }
} public bool EnableCache
{
get { return _enableCache; }
set { _enableCache = value; }
} protected override void OnInit(EventArgs e)
{
const string key = "swfobject";
string swfobjectfile = ExternalSWFObjectFile;
if (string.IsNullOrEmpty(ExternalSWFObjectFile))
swfobjectfile = Page.ClientScript.GetWebResourceUrl(this.GetType(), "OpenFlashChart.swfobject.js");
if (!this.Page.ClientScript.IsClientScriptBlockRegistered(key))
{
this.Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), key, "<script type=\"text/javascript\" src=\"" + swfobjectfile + "\"></script>");
}
base.OnInit(e);
}
public override void RenderControl(HtmlTextWriter writer)
{
StringBuilder builder = new StringBuilder();
if (string.IsNullOrEmpty(ExternalSWFfile))
ExternalSWFfile = Page.ClientScript.GetWebResourceUrl(this.GetType(), "OpenFlashChart.open-flash-chart.swf");
builder.AppendFormat("<div id=\"{0}\">", this.ClientID);
builder.AppendLine("</div>");
builder.AppendLine("<script type=\"text/javascript\">");
builder.AppendFormat("swfobject.embedSWF(\"{0}\", \"{1}\", \"{2}\", \"{3}\",\"9.0.0\", \"expressInstall.swf\",",
ExternalSWFfile, this.ClientID, Width, Height);
builder.Append("{\"data-file\":\"");
//if both chart,datafile exists ,chart win.
if (ChartJson != null)
{
if (!EnableCache)
Page.Cache.Remove(this.ClientID);
Page.Cache.Add(this.ClientID, ChartJson, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 10, 0),
CacheItemPriority.Normal, null);
builder.Append("ofc_handler.aspx?chartjson=" + this.ClientID + "%26ec=" + (EnableCache ? "1" : "0"));
}
else
builder.Append(HttpUtility.UrlEncode(DataFile));
builder.Append("\"");
if (!string.IsNullOrEmpty(loadingmsg))
{
builder.AppendFormat(",\"loading\":\"{0}\"", loadingmsg);
}
builder.Append("});");
builder.AppendLine("</script>");
writer.Write(builder.ToString());
base.RenderControl(writer);
}
}
}