本文整理汇总了C#中System.Web.UI.WebControls.XmlDataSource类的典型用法代码示例。如果您正苦于以下问题:C# XmlDataSource类的具体用法?C# XmlDataSource怎么用?C# XmlDataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlDataSource类属于System.Web.UI.WebControls命名空间,在下文中一共展示了XmlDataSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (System.Configuration.ConfigurationManager.AppSettings["siteId"] != null)
{
Microsite.SiteUtils.siteId = System.Configuration.ConfigurationManager.AppSettings["siteId"];
}
if (System.Configuration.ConfigurationManager.AppSettings["domainKey"] != null)
{
Microsite.SiteUtils.domainKey = System.Configuration.ConfigurationManager.AppSettings["domainKey"];
}
if (System.Configuration.ConfigurationManager.AppSettings["domainName"] != null)
{
Microsite.SiteUtils.domainName = System.Configuration.ConfigurationManager.AppSettings["domainName"];
}
if (System.Configuration.ConfigurationManager.AppSettings["shortKey"] != null)
{
Microsite.SiteUtils.shortKey = System.Configuration.ConfigurationManager.AppSettings["shortKey"];
}
if (System.Configuration.ConfigurationManager.AppSettings["longKey"] != null)
{
Microsite.SiteUtils.longKey = System.Configuration.ConfigurationManager.AppSettings["longKey"];
}
XmlDataSource xds = new XmlDataSource();
xds.DataFile = "skynet.xml";
xds.XPath = "/site";
repeaterXML.DataSource = xds;
repeaterXML.DataBind();
}
}
示例2: Xml_Data1_ItemDataBound
protected void Xml_Data1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
XmlDataSource xds = new XmlDataSource();
xds.DataFile = (e.Item.DataItem as feed).url;
xds.XPath = "rss/channel";
Repeater Xml_Data2 = e.Item.FindControl("Xml_Data2") as Repeater;
Xml_Data2.DataSource = xds;
Xml_Data2.DataBind();
}
示例3: AddRewriteNameSpaceForXslt
/// <summary>
/// Adds the rewrite namespace so that it can be used from within XSLT.
/// </summary>
/// <param name="xmlDataSource">The XML data source.</param>
public static void AddRewriteNameSpaceForXslt(XmlDataSource xmlDataSource)
{
if (_rewriteService == null)
_rewriteService = new RewriteService();
if (xmlDataSource.TransformArgumentList == null)
xmlDataSource.TransformArgumentList = new XsltArgumentList();
xmlDataSource.TransformArgumentList.AddExtensionObject("dc:urlRewrite", _rewriteService);
}
示例4: LeftMenu_ItemDataBound
protected void LeftMenu_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
XmlDataSource xmlDSSubMenu = new XmlDataSource();
xmlDSSubMenu.EnableCaching = false;
xmlDSSubMenu.Data = xmlDSMenu.Data;
xmlDSSubMenu.XPath = @"siteMap/menu[" + (e.Item.ItemIndex + 1).ToString() + "]/subMenu/menu";
((Repeater)e.Item.FindControl("RepaterDate2")).DataSource = xmlDSSubMenu;
((Repeater)e.Item.FindControl("RepaterDate2")).DataBind();
}
示例5: XmlDataSourceConfigureDataSourceForm
public XmlDataSourceConfigureDataSourceForm(IServiceProvider serviceProvider, XmlDataSource xmlDataSource) : base(serviceProvider)
{
this._xmlDataSource = xmlDataSource;
this.InitializeComponent();
this.InitializeUI();
this.DataFile = this._xmlDataSource.DataFile;
this.TransformFile = this._xmlDataSource.TransformFile;
this.XPath = this._xmlDataSource.XPath;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:XmlDataSourceConfigureDataSourceForm.cs
示例6: Index
//
// GET: /ReadBook/
public ActionResult Index()
{
XmlDataSource xds = new XmlDataSource();
DataSet ds = new DataSet();
ds.ReadXml(@"C:\Projects\BookReader\BookReader\Files\Prod\005_Iqan.xml");
ViewBag.BookId = new SelectList(BookManager.GetAll(), "Id", "Title");
return View(new ReadBookViewModel());
}
示例7: Index
public ActionResult Index()
{
var doc = new XmlDocument();
doc.Load(this.Server.MapPath("~/Areas/TreePanel_Loaders/Content/authors.xml"));
XmlDataSource xmldataSource = new XmlDataSource();
xmldataSource.Data = doc.OuterXml;
xmldataSource.ID = DateTime.Now.Ticks.ToString(); // unique ID is required
return View(xmldataSource);
}
示例8: MontaNoticia
//TODO: Acho melhor assim. *adsneris
//protected void MontaNoticia(object sender, EventArgs e)
//{
// RssBO rssBO = new RssBO();
// BaseVO rssVO = new RssVO();
// Button b = (Button)sender;
// rssVO.Campo("time").Valor = b.ID;
// rssVO = rssBO.ObterDadosVOPorCampo("time", rssVO);
// Noticia(rssVO.Campo("link").Valor.ToString());
//}
protected void MontaNoticia(string rss)
{
XmlDataSource XmlDataSource1 = new XmlDataSource();
XmlDataSource1.DataFile = rss;
XmlDataSource1.XPath = "rss/channel/item";
DataList_Noticias.DataSource = XmlDataSource1;
DataList_Noticias.DataBind();
DataList_Noticias.Visible = true;
DataList_Noticias.SelectedIndex = -1;
}
示例9: XmlDataSourceView
public XmlDataSourceView (XmlDataSource owner, string name, XmlNodeList nodes)
: base (owner, name)
{
// Why do they pass owner?
this.name = name;
this.nodes = new ArrayList (nodes.Count);
foreach (XmlNode node in nodes) {
if (node.NodeType == XmlNodeType.Element)
this.nodes.Add (node);
}
}
示例10: GetMenuDataSource
/// <summary>
/// Carrega os itens do menu conforme perfil logado
/// </summary>
/// <param name="menu"></param>
/// <param name="serverMapPath"></param>
/// <returns></returns>
XmlDataSource GetMenuDataSource(string menu, string serverMapPath)
{
XmlDataSource objData = new XmlDataSource();
objData.XPath = "siteMap/siteMapNode";
switch (menu)
{
case "Administrador": //Caso seja o perfil Administrador carrega o perfil setado no xml
objData.DataFile = serverMapPath + @"\App_Data\Administrador.sitemap";
break;
default:
break;
}
objData.DataBind();
return objData;
}
示例11: loadMenu
private void loadMenu()
{
List<CATEGORY> categories = ApplicationContext.Current.Categories.GetCategoryListByCampaign(CampaignID);
string path = Context.Server.MapPath(Configuration.XmlPath);
string culture = String.Empty;
if (Session["Culture"] != null)
{
culture = Session["Culture"].ToString();
}
String filename = XmlUtil.CreateCategoriesXml(categories, CampaignID, path, culture);
if (!String.IsNullOrEmpty(filename))
{
XmlDataSource menuDataSource = new XmlDataSource();
menuDataSource.XPath = "Node/Menu";
menuDataSource.DataFile = filename;
menuCat.DataSource = menuDataSource;
menuCat.DataBind();
}
}
示例12: GetDesignTimeXmlDataSource
internal System.Web.UI.WebControls.XmlDataSource GetDesignTimeXmlDataSource(string viewPath)
{
System.Web.UI.WebControls.XmlDataSource source = new System.Web.UI.WebControls.XmlDataSource {
EnableCaching = false,
Data = this.XmlDataSource.Data,
Transform = this.XmlDataSource.Transform,
XPath = string.IsNullOrEmpty(viewPath) ? this.XmlDataSource.XPath : viewPath
};
if (this.XmlDataSource.DataFile.Length > 0)
{
if (this._mappedDataFile == null)
{
this._mappedDataFile = UrlPath.MapPath(base.Component.Site, this.XmlDataSource.DataFile);
}
source.DataFile = this._mappedDataFile;
if (!File.Exists(source.DataFile))
{
return null;
}
}
else if (source.Data.Length == 0)
{
return null;
}
if (this.XmlDataSource.TransformFile.Length > 0)
{
if (this._mappedTransformFile == null)
{
this._mappedTransformFile = UrlPath.MapPath(base.Component.Site, this.XmlDataSource.TransformFile);
}
source.TransformFile = this._mappedTransformFile;
if (!File.Exists(source.TransformFile))
{
return null;
}
}
return source;
}
示例13: Initialize
public override void Initialize(IComponent component)
{
ControlDesigner.VerifyInitializeArgument(component, typeof(System.Web.UI.WebControls.XmlDataSource));
base.Initialize(component);
this._xmlDataSource = (System.Web.UI.WebControls.XmlDataSource) component;
}
示例14: SelectFromXmlDataSourceEditUpdate
public void SelectFromXmlDataSourceEditUpdate()
{
Grid grid = new Grid();
SetupGrid(grid);
XmlDataSource ds = new XmlDataSource();
ds.XPath = "//Language//*";
ds.ID = "test1";
ds.DataFile = Path + "\\WebGridMessages.xml";
Testpage.Controls.Add(ds);
grid.DataSourceId = ds.ID;
grid["LanguageID"].Primarykey = true;
grid.EditIndex = "Norwegian";
grid.DisplayView = DisplayView.Detail;
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
string text = "T:" + DateTime.Now.Ticks;
grid.Rows[0]["PagerPrefix"].Value = text;
grid.BeforeUpdateInsert += grid_BeforeUpdateInsert;
grid.RaisePostBackEvent("RecordUpdateClick!Norwegian!False");
grid.RenderControl(gridwriter);
Assert.Greater(grid.Rows.Count, 1, sb.ToString());
Assert.LessOrEqual(grid.SystemMessage.Count, 1);
string filecontent = System.IO.File.ReadAllText(Path + "\\WebGridMessages.xml");
Assert.Greater(filecontent.IndexOf(text), 0);
/* string[] triggerStrings = new[]
{
"Forrige side",
"RecordCancelClick!Norwegian!",
"RecordUpdateClick!Norwegian!False"
};
string content = sb.ToString();
foreach (string part in triggerStrings)
{
int res = content.IndexOf(part);
Assert.Greater(res, -1, part + Environment.NewLine + content);
}
*/
}
示例15: SelectFromXmlDataSourceEdit
public void SelectFromXmlDataSourceEdit()
{
Grid grid = new Grid();
SetupGrid(grid);
XmlDataSource ds = new XmlDataSource();
ds.XPath = "//Language//*";
ds.ID = "test1";
ds.DataFile = Path + "\\WebGridMessages.xml";
Testpage.Controls.Add(ds);
grid.DataSourceId = ds.ID;
grid["LanguageID"].Primarykey = true;
grid.RaisePostBackEvent("RecordClick!!Norwegian");
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
grid.RenderControl(gridwriter);
Assert.AreEqual(grid.MasterTable.Rows.Count, 1);
Assert.LessOrEqual(grid.SystemMessage.Count, 1);
string[] triggerStrings = new[]
{
"Forrige side",
"RecordCancelClick!Norwegian!",
"RecordUpdateClick!Norwegian!False"
};
string content = sb.ToString();
foreach (string part in triggerStrings)
{
int res = content.IndexOf(part);
Assert.Greater(res, -1, part + Environment.NewLine + content);
}
}