Thursday, 15 July 2010

Manipulating an ASP.Net TreeView that's in a Master Page from a different web page -



Manipulating an ASP.Net TreeView that's in a Master Page from a different web page -

we manipulate asp.net treeview that's in master page different web page.

this coding master page web form code-behind file. duplicate coding in page_load event of web page's code-behind file. when seek utilize coding in other web form,

objtreeview = knowledge_academy1.loginview.findcontrol("treeviewmain")

we error states loginview protected. how unprotect can duplicate same coding?

here working coding master web form code-behind file:

public class knowledge_academy1 inherits system.web.ui.masterpage protected sub treeviewmain_treenodeexpanded(sender object, e treenodeeventargs) dim objtreeview treeview objtreeview = loginview.findcontrol("treeviewmain") select case e.node.text case "maintenance" ' create sure nodes except maintenance collapsed. '---------------------------------------------------------- each treenode treenode in objtreeview.nodes if treenode.text = "parents" or treenode.text = "students" or treenode.text = "financial" treenode.collapse() end if next treenode case "students" ' create sure nodes except students collapsed. '------------------------------------------------------- each treenode treenode in objtreeview.nodes if treenode.text = "parents" or treenode.text = "maintenance" or treenode.text = "financial" treenode.collapse() end if next treenode case "parents" ' create sure nodes except parents collapsed. '------------------------------------------------------ each treenode treenode in objtreeview.nodes if treenode.text = "students" or treenode.text = "maintenance" or treenode.text = "financial" treenode.collapse() end if next treenode case "financial" ' create sure nodes except financial collapsed. '-------------------------------------------------------- each treenode treenode in objtreeview.nodes if treenode.text = "parents" or treenode.text = "maintenance" or treenode.text = "students" treenode.collapse() end if next treenode case else end select end sub

i suggest looking @ msdn article: http://msdn.microsoft.com/en-us/library/xxwa0ff0(vs.80).aspx

so example:

dim mptreeview treeview mptreeview = ctype(master.findcontrol("treeviewmain"), treeview)

asp.net treeview code-behind protected

No comments:

Post a Comment