當前位置: 首頁>>代碼示例>>C#>>正文


C# WebControls.XmlDataSource類代碼示例

本文整理匯總了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();
            }
        }
開發者ID:scopes,項目名稱:microsite,代碼行數:34,代碼來源:MasterPage.master.cs

示例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();
 }
開發者ID:JesperPetersenDk,項目名稱:web-integrator-opgaver,代碼行數:9,代碼來源:nyheder.aspx.cs

示例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);
        }
開發者ID:montyclift,項目名稱:dashcommerce-3,代碼行數:13,代碼來源:RewriteService.cs

示例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();
 }
開發者ID:yangkai1992,項目名稱:sz1card1,代碼行數:9,代碼來源:Left.aspx.cs

示例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());
        }
開發者ID:imanf,項目名稱:BookReader,代碼行數:13,代碼來源:ReadBookController.cs

示例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);
        }
開發者ID:extnet,項目名稱:Ext.NET.Examples.MVC,代碼行數:11,代碼來源:XML_File_LoadingController.cs

示例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;
        }
開發者ID:JulianRSena,項目名稱:projeto-suajogada,代碼行數:21,代碼來源:Noticia.aspx.cs

示例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);
			}
		}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:12,代碼來源:XmlDataSourceView.cs

示例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;
 }
開發者ID:danygolden,項目名稱:gianfratti,代碼行數:21,代碼來源:Menu.ascx.cs

示例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();
     }
 }
開發者ID:gertgjoka,項目名稱:fashion-commerce,代碼行數:19,代碼來源:CategoryMenu.ascx.cs

示例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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:38,代碼來源:XmlDataSourceDesigner.cs

示例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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:6,代碼來源:XmlDataSourceDesigner.cs

示例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);
            }
            */
        }
開發者ID:webgrid,項目名稱:WebGrid,代碼行數:43,代碼來源:DataSourceControl.cs

示例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);
            }
        }
開發者ID:webgrid,項目名稱:WebGrid,代碼行數:35,代碼來源:DataSourceControl.cs


注:本文中的System.Web.UI.WebControls.XmlDataSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。