How to Create a Treeview Menu in ASP.NET with C#?



How to Create a Treeview Menu in ASP.NET with C#?..

Answer / guest

Microsoft.Web.UI.WebControls.TreeView Treeview11

public void PopulateTree()
{
TreeNode nodeProdDetail, nodeProdMaster;
nodeProdMaster = new TreeNode();
nodeProdMaster.Text = "Master1";
nodeProdMaster.ID = "1";

nodeProdDetail = new TreeNode();
nodeProdDetail.Text = "Detail1";
nodeProdDetail.ID = "1.1";
nodeProdDetail.NavigateUrl = "SomePage.aspx";
nodeProdMaster.Nodes.Add(nodeProdDetail);

Treeview1.Nodes.Add(nodeProdMaster);

nodeProdMaster = new TreeNode();
nodeProdMaster.Text = "Master2";
nodeProdMaster.ID = "2";

nodeProdDetail = new TreeNode();
nodeProdDetail.Text = "Detail2";
nodeProdDetail.ID = "2.1";
nodeProdDetail.NavigateUrl = "SomeOtherPage.aspx";
nodeProdMaster.Nodes.Add(nodeProdDetail);

Treeview1.Nodes.Add(nodeProdMaster);
}

Is This Answer Correct ?    25 Yes 22 No

Post New Answer

More C Sharp Code Interview Questions

program for addition of fraction(M/N + P/Q = Y/Z)

1 Answers   Mind Tree,


How to Link Different Data Sources Together?

0 Answers  


How to add a value from textBox over an existing certain column in SQL Server

0 Answers  


Write a program to count 3Letter, 4Letter and 5Letter words from a file and print the number of 3Letter, 4Letter and 5Letter words. Delimiter is space, tab, hifen. Also we should not consider the line in the file after we encounter # in that line.

0 Answers   Mind Tree,


IS Array list is generic or non generic

1 Answers  


Write a program which has a function and that function should take 2 or 3 or any number of strings and it should return the largest common prefix of all those strings. If there is no common prefix it should return an empty string. for eg:- INPUT OUTPUT glo {glory,glorious,glod} gl {glad,glow} {calendar,phone} empty string

2 Answers   Mind Tree,


Coding for Manipulate XML File Data Using C#?

1 Answers  


working with arrays

1 Answers  


Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }

0 Answers  


Code for Reading and writing from a file in c#?

1 Answers  


I am developing a web application using google map api.I want to update the map inside the div control within update panel. I got other controls updated but map doesn't get updated.I do not not want to update map whenever unnecessary controls are fired at server side.How could it be achieved?

0 Answers  


Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#

1 Answers  


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)