Наследование: HierarchicalDataSourceControl, IDataSource, IListSource
Пример #1
0
        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();
            }
        }
        protected internal override void PerformDataBinding(IEnumerable data)
        {
            if (data != null)
            {
                // We retrieve ad data from xml format in a specific way.
                XmlDataSource xmlDataSource = null;
                object        dataSource    = DataSource;
                if (dataSource != null)
                {
                    xmlDataSource = dataSource as XmlDataSource;
                }
                else   // DataSourceID case, we know that only one source is available
                {
                    xmlDataSource = GetDataSource() as XmlDataSource;
                }

                if (xmlDataSource != null)
                {
                    _adRecs = GetXmlDataSourceData(xmlDataSource);
                }
                else
                {
                    _adRecs = GetDataSourceData(data);
                }
            }
        }
 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;
 }
 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();
 }
Пример #5
0
 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();
 }
Пример #6
0
        /// <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);
        }
Пример #7
0
        private AdRec[] GetXmlDataSourceData(XmlDataSource xmlDataSource)
        {
            XmlDocument xmlDocument = xmlDataSource.GetXmlDocument();

            if (xmlDocument == null)
            {
                return(null);
            }
            return(this.LoadXmlDocument(xmlDocument));
        }
Пример #8
0
        //
        // 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());
        }
        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);
        }
Пример #10
0
        //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;
        }
		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);
			}
		}
        private AdRec [] GetXmlDataSourceData(XmlDataSource xmlDataSource)
        {
            Debug.Assert(xmlDataSource != null);

            XmlDocument doc = xmlDataSource.GetXmlDocument();

            if (doc == null)
            {
                return(null);
            }
            return(LoadXmlDocument(doc));
        }
Пример #13
0
        internal IHierarchicalEnumerable GetHierarchicalRuntimeEnumerable(string path)
        {
            System.Web.UI.WebControls.XmlDataSource designTimeXmlDataSource = this.GetDesignTimeXmlDataSource(string.Empty);
            if (designTimeXmlDataSource == null)
            {
                return(null);
            }
            HierarchicalDataSourceView hierarchicalView = ((IHierarchicalDataSource)designTimeXmlDataSource).GetHierarchicalView(path);

            if (hierarchicalView == null)
            {
                return(null);
            }
            return(hierarchicalView.Select());
        }
Пример #14
0
 /// <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;
 }
 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();
     }
 }
Пример #16
0
        internal IEnumerable GetRuntimeEnumerable(string listName)
        {
            System.Web.UI.WebControls.XmlDataSource designTimeXmlDataSource = this.GetDesignTimeXmlDataSource(string.Empty);
            if (designTimeXmlDataSource == null)
            {
                return(null);
            }
            XmlDataSourceView view = (XmlDataSourceView)((IDataSource)designTimeXmlDataSource).GetView(listName);

            if (view == null)
            {
                return(null);
            }
            IEnumerable enumerable = view.Select(DataSourceSelectArguments.Empty);
            ICollection is2        = enumerable as ICollection;

            if ((is2 != null) && (is2.Count == 0))
            {
                return(null);
            }
            return(enumerable);
        }
Пример #17
0
 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);
 }
 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;
 }
Пример #19
0
 protected internal override void PerformDataBinding(IEnumerable data)
 {
     if (data != null)
     {
         XmlDataSource xmlDataSource = null;
         object        dataSource    = this.DataSource;
         if (dataSource != null)
         {
             xmlDataSource = dataSource as XmlDataSource;
         }
         else
         {
             xmlDataSource = this.GetDataSource() as XmlDataSource;
         }
         if (xmlDataSource != null)
         {
             this._adRecs = this.GetXmlDataSourceData(xmlDataSource);
         }
         else
         {
             this._adRecs = this.GetDataSourceData(data);
         }
     }
 }
Пример #20
0
        public void SelectFromXmlDataSourceControl()
        {
            Testpage.Controls.Clear();
            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["LanguageID"].HyperLinkColumn = true;
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
            //It is converted to from XmlDataSource to EnumerableDataSource
            Assert.AreEqual(grid.MasterTable.DataSourceType, DataSourceControlType.EnumerableDataSource);
            Assert.Greater(grid.MasterTable.Rows.Count, 1);

            string[] triggerStrings = new[]
                                          {
                                              "Fehler beim Speichern mehrerer",
                                              "Forrige side",
                                              "RecordDeleteClick!Danish",
                                              "ExcelExportClick",
                                              "RecordClick!LanguageID!Norwegian",
                                          };
            string content = sb.ToString();
            foreach (string part in triggerStrings)
            {
                int res = content.IndexOf(part);
                Assert.Greater(res, -1, part + Environment.NewLine + content);
            }
        }
Пример #21
0
		public void OnLoad_WithDataSource ()
		{
			XmlDataSource ds = new XmlDataSource ();
			ds.ID = "mono";
			TestBaseDataList bdl = new TestBaseDataList ();
			Page p = new Page ();
			bdl.Page = p;
			p.Controls.Add (ds);
			p.Controls.Add (bdl);
			bdl.DataSourceID = "mono";
			Assert.IsTrue (bdl.IsDataBoundByDataSourceId, "IsBoundUsingDataSourceID");
			Assert.IsTrue (bdl.EnableViewState, "EnabledViewState");
			Assert.IsFalse (bdl.Page.IsPostBack, "IsPostBack");
			bdl.BaseOnLoad (EventArgs.Empty);
			Assert.IsTrue (bdl.IsInitialized, "IsInitialized");
			Assert.IsTrue (bdl.RequiresDataBind, "RequiresDataBind");
		}
Пример #22
0
		public void EnsureDataBound_WithDataSourceID ()
		{
			XmlDataSource ds = new XmlDataSource ();
			ds.Data = "";
			ds.ID = "mono";
			TestBaseDataList bdl = new TestBaseDataList ();
			Page p = new Page ();
			bdl.Page = p;
			p.Controls.Add (ds);
			p.Controls.Add (bdl);
			bdl.DataSourceID = "mono";

			Assert.IsFalse (bdl.DataBindingCalled, "Before EnsureDataBound");
			bdl.Ensure ();
			Assert.IsFalse (bdl.DataBindingCalled, "After EnsureDataBound");

			bdl.BaseOnLoad (EventArgs.Empty);
			bdl.Ensure ();
			Assert.IsTrue (bdl.DataBindingCalled, "After BaseOnLoad|RequiresDataBinding");
		}
 /// <devdoc>
 /// Creates a new instance of XmlHierarchicalDataSourceView.
 /// </devdoc>
 internal XmlHierarchicalDataSourceView(XmlDataSource owner, string viewPath)
 {
     Debug.Assert(owner != null);
     _owner    = owner;
     _viewPath = viewPath;
 }
Пример #24
0
		public XmlDataSourceView (XmlDataSource owner, string name)
			: base (owner, name)
		{
			this.owner = owner;
		}
 public XmlDataSourceView(XmlDataSource owner, string name) : base(default(System.Web.UI.IDataSource), default(string))
 {
 }
Пример #26
0
 public XmlDataSourceView(XmlDataSource owner, string name)
     : base(owner, name)
 {
     this.owner = owner;
 }
		public static void pageLoadNodeExpandAll (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.CollapseAll ();
			tv.Nodes[0].ChildNodes[0].ExpandAll ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
		public static void pageLoadRenderLevelStyleCssClass (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";

			TreeNodeStyle tns = new TreeNodeStyle ();
			tns.CssClass = "TestCssClass1";
			tv.LevelStyles.Add (tns);
			
			tns = new TreeNodeStyle ();
			tns.CssClass = "TestCssClass2";
			tv.LevelStyles.Add (tns);

			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
Пример #29
0
 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;
 }
Пример #30
0
		public static void Menu_DataBindByDataSourceID_PageInit (Page p) {
			XmlDataSource xmlDs = new XmlDataSource ();
			xmlDs.ID = "XmlDataSource";
			xmlDs.Data = "<root><node /><node /><node><subnode /><subnode /></node></root>";
			p.Form.Controls.Add (xmlDs);

			Menu m = CreateMenu ();
#if NET_4_0
			m.RenderingMode = MenuRenderingMode.Table;
#endif
			m.DataSourceID = "XmlDataSource";
			m.MenuItemDataBound += new MenuEventHandler (m_MenuItemDataBound);
			p.Form.Controls.Add (m);

			ResetTemplateBoundFlags ();
			_MenuItemBoundCount = 0;
			_MenuItemCreatedCount = 0;
		}
Пример #31
0
        public void SelectFromXmlDataSourceControlSearch()
        {
            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.Search = "\"a\" -t";
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
            Assert.AreEqual(grid.MasterTable.Rows.Count, 6);
        }
Пример #32
0
        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);
            }
            */
        }
Пример #33
0
        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);
            }
        }
		public static void pageLoadNodeStates2 (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.Nodes[0].Checked = false;
			tv.Nodes[0].ChildNodes[0].Selected = true;
			tv.Nodes[0].ChildNodes[0].Expanded = false;
			tv.Nodes[0].ChildNodes[0].ChildNodes[0].PopulateOnDemand = true;
			tv.Nodes[0].ChildNodes[0].ChildNodes[1].ShowCheckBox = false;
			tv.Nodes[0].ChildNodes[1].SelectAction = TreeNodeSelectAction.Expand;
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
 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;
 }
		public static void PostBackFireEvents_3 (Page p)
		{
			TreeView tv = new TreeView ();
			tv.TreeNodeCollapsed += new TreeNodeEventHandler (tv_TreeNodeCollapsed);
			tv.TreeNodeExpanded +=new TreeNodeEventHandler(tv_TreeNodeExpanded);
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.Nodes[0].Checked = true;
			tv.Nodes[0].ChildNodes[0].Selected = false;
			tv.Nodes[0].ChildNodes[0].Expanded = true;
			tv.Nodes[0].ChildNodes[0].ChildNodes[0].PopulateOnDemand = false;
			tv.Nodes[0].ChildNodes[0].ChildNodes[1].ShowCheckBox = true;
			tv.Nodes[0].ChildNodes[1].SelectAction = TreeNodeSelectAction.SelectExpand;
			p.Form.Controls.Add (tv);

			
		}
		public void TreeView_MaxDataBindDepth () {
			TreeView tv = new TreeView ();
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.MaxDataBindDepth = 1;
			_TreeNodeDataBoundCount = 0;
			tv.TreeNodeDataBound += new TreeNodeEventHandler (TreeView_TreeNodeDataBound);
			Assert.AreEqual (0, tv.Nodes.Count, "BeforeDataBind1");
			tv.DataBind ();
			Assert.AreEqual (1, tv.Nodes.Count, "AfterDataBind1-a");
			Assert.AreEqual ("Book", tv.Nodes [0].Text, "AfterDataBind1-b");
			Assert.AreEqual (2, tv.Nodes [0].ChildNodes.Count, "AfterDataBind1-c");
			Assert.AreEqual (0, tv.Nodes [0].ChildNodes [0].ChildNodes.Count, "AfterDataBind1-d");
			Assert.AreEqual (3, _TreeNodeDataBoundCount, "AfterDataBind1-TreeNodeDataBoundCount");
		}
		public void TreeView_Method_FindNode () {
			PokerTreeView tv = new PokerTreeView ();
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			TreeNode tn = new TreeNode ();
			Assert.AreEqual (0, tn.ChildNodes.Count, "BeforeFindNode");
			tn = tv.FindNode ("Book" + tv.PathSeparator + "Chapter");
			Assert.AreEqual ("Chapter", tn.Text, "AfterFindNode1");
			Assert.AreEqual (2, tn.ChildNodes.Count, "AfterFindNode2");
			Assert.AreEqual ("Section", tn.ChildNodes[0].Text, "AfterFindNode3");
		}
Пример #39
0
		public static XmlDataSource LoadXml ()
		{
			XmlDataSource ds = new XmlDataSource ();
			ds.EnableCaching = false;
			#region xml_doc
			String xml_text = @"<siteMapNode url=""1"" title=""root""  description="""">
						<siteMapNode url=""~/MyPage.aspx"" title=""node1""  description="""" />
					    </siteMapNode>";
			#endregion
			ds.Data = xml_text;
			return ds;
		}
		public static void pageLoadRenderDefaults (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
Пример #41
0
		XmlDataSource CreateXmlDataSource () {
			XmlDataSource xmlDs = new XmlDataSource ();
			xmlDs.ID = "XmlDataSource";
			xmlDs.Data = "<root>"+
				"<node url=\"url#1\" img=\"img#1\" enabled=\"true\" selectable=\"true\" popoutimg=\"popoutimg#1\" separatorimg=\"separatorimg#1\" target=\"target#1\" text=\"1\" tooltip=\"tooltip#1\" value=\"value#1\" />" +
				"<node url=\"url#2\" img=\"img#2\" enabled=\"false\" selectable=\"false\" popoutimg=\"popoutimg#2\" separatorimg=\"separatorimg#2\" target=\"target#2\" text=\"2\" tooltip=\"tooltip#2\" value=\"value#2\" />" +
				"<node url=\"\" img=\"\" enabled=\"\" selectable=\"\" popoutimg=\"\" separatorimg=\"\" target=\"\" text=\"\" tooltip=\"\" value=\"\">" +
				"<subnode url=\"url#unreachable\" img=\"img#unreachable\" enabled=\"false\" selectable=\"false\" popoutimg=\"popoutimg#unreachable\" separatorimg=\"separatorimg#unreachable\" target=\"target#unreachable\" text=\"text#unreachable\" tooltip=\"tooltip#unreachable\" value=\"value#unreachable\" />" +
				"<subnode /></node>"+
				"<extra1 /><extra2 />"+
				"<extra3 text=\"text#extra3\" value=\"\" />" +
				"<extra3 text=\"\" value=\"value#extra3\" />" +
				"<extra3 text=\"\" value=\"\" />" +
				"<extra4 text=\"text#extra4\" value=\"\" />" +
				"<extra5 text=\"\" value=\"value#extra5\" />" +
				"</root>";
			return xmlDs;
		}
 internal XmlHierarchicalDataSourceView(XmlDataSource owner, string viewPath)
 {
     this._owner    = owner;
     this._viewPath = viewPath;
 }