|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
TreeView problemI've got a MasterPage <%@ Master Language="C#" ClassName="MasterP" %> and some slave.aspx.<%@ Page Language="C#" MasterPageFile="~/Master1.master" AutoEventWireup="true" CodeFile="ShowDatabases.aspx.cs" Inherits="ShowDatabases" Title="Untitled Page" %><%@ MasterType VirtualPath="Master1.master" %> In the slave page I'm creting and populating a TreeView which I would like to pass to my MasterPage , where exists a TreeView Control.So I've defined a function //MasterPage code, public void FetchTree(TreeView dbs) { //the right code ;) // tried TreeView2 = dbs; but fails } //slave page code Master.FetchTree(treeCreatedInSlave); (There's no doubt about code, because when I type Master. the IntelliSense sees the FetchTree method. I'm telling this, because my problem is only in the tree.) So how to do it without I know I could build XML from slave tree and then get that XML in master but I belive there's a faster way! Thanks!!! Really nobody :(
Maybe I've described the problem wrong. So I repeat: There are two pages in one I'm creating a TreeView like that: TreeView dbTree = new TreeView(); TreeNode dbTreeRoot = new TreeNode("Root"); dbTree.Nodes.Add(dbTreeRoot); .. .. - so my complete TreeView is populated in that code. Now I wish to pass this whole TreeView to another site, where I've got my TreeView Control: <asp:TreeView ID="TreeView2" runat="server"> </asp:TreeView> So how to pass this tree to put it into that control?? I thing that it should be a function in the second page: public void FetchTree(TreeView source_tree) { // - the code, I've tried TreeView2 = source_tree, but it's not a solution } Or the only way is to save a TreeView to XML in a first, and then to retrive it from XML in a second page to the control directly. Thank you in advance! What do you mean by 'site'?
If it's just another page and session remains..? You can store it in a session or flat (xml)file. If it's the same app. you could try to use previous page object and enum the parts over. Not sure if that will work. Show quoteHide quote "christof" <nom***@nomail.de> schreef in bericht news:eRVQh508FHA.3976@TK2MSFTNGP15.phx.gbl... > > Really nobody :( > > Maybe I've described the problem wrong. So I repeat: > > There are two pages in one I'm creating a TreeView like that: > > TreeView dbTree = new TreeView(); > > TreeNode dbTreeRoot = new TreeNode("Root"); > dbTree.Nodes.Add(dbTreeRoot); > .. > .. > > - so my complete TreeView is populated in that code. > Now I wish to pass this whole TreeView to another site, where I've got my > TreeView Control: > > <asp:TreeView ID="TreeView2" runat="server"> > </asp:TreeView> > > So how to pass this tree to put it into that control?? > > I thing that it should be a function in the second page: > > public void FetchTree(TreeView source_tree) > { > // - the code, I've tried TreeView2 = source_tree, but it's not a > solution > } > > Or the only way is to save a TreeView to XML in a first, and then to > retrive it from XML in a second page to the control directly. > > Thank you in advance! > Edwin Knoppert wrote:
> What do you mean by 'site'? There is no problem with storing it, but how to make the other TreeView > > If it's just another page and session remains..? > You can store it in a session or flat (xml)file. > If it's the same app. you could try to use previous page object and enum the > parts over. > Not sure if that will work. just exactly the same as one that I've created. So some kind of copying objects. TreeView2 is on a MasterPage TreeView1 is on other page TreeView2 = TreeView1; So I've got exactly the same tree in both sites! That's what I'm asking, thanks There was a question about getting controls on such pages a few days ago.
Then i assume simply copying properties? Like styles and such. + copying the items of course. Show quoteHide quote "christof" <nom***@nomail.de> schreef in bericht news:evMkxj18FHA.3952@TK2MSFTNGP12.phx.gbl... > Edwin Knoppert wrote: >> What do you mean by 'site'? >> >> If it's just another page and session remains..? >> You can store it in a session or flat (xml)file. >> If it's the same app. you could try to use previous page object and enum >> the parts over. >> Not sure if that will work. > > There is no problem with storing it, but how to make the other TreeView > just exactly the same as one that I've created. So some kind of copying > objects. > > TreeView2 is on a MasterPage > TreeView1 is on other page > > TreeView2 = TreeView1; > > So I've got exactly the same tree in both sites! > That's what I'm asking, thanks
Other interesting topics
ASP.NET 2.0 Frustration - MS Please Help
ASP.NET does not honor Title nor Javscript options Odd behavior in 2005 with base page classes Web.Config file seems to be ignored Accessing session from thread Wizard Control Forms authentication with images on the login page Problem migrating Web Project from ASP.Net 1.1 to 2.0 Q: moving project folder Conditional directive |
|||||||||||||||||||||||