📄 xmlnewsfeed.cs
字号:
using System;
using System.Xml;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Data;
namespace XMLNewsFeed
{
/// <summary>
/// Summary description for WebCustomControl1.
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:XMLNewsFeed runat=server></{0}:XMLNewsFeed>")]
public class XMLNewsFeed: System.Web.UI.WebControls.WebControl
{
private string _text;
private System.Data.DataSet _xmldataset =
new System.Data.DataSet();
private string _xmlsource;
[Bindable(true),
Category("Data"),
DefaultValue("")]
public string XMLSource
{
set
{
try
{
_xmlsource = value;
}
catch (Exception e)
{
_text = "Error unable to set property [XMLSource] to that value<br>[" + e.Message + "]";
}
}
}
[Bindable(true),
Category("Data"),
DefaultValue("")]
public System.Data.DataSet XMLDataSet
{
get
{
return _xmldataset;
}
}
[Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string Text
{
get
{
return _text;
}
set
{
_text = value;
}
}
/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)
{
output.Write(Text);
}
public void Populate()
{
//TODO Change this to only load after the skip XML statement
_xmldataset.ReadXml(_xmlsource);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -