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

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  


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  


c# coding for a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors not using the Big-integer and Exponential Function's.

1 Answers   TCS,


Create a class called Accounts which has data members like ACCOUNT no, Customer name, Account type, Transaction type (d/w), amount, balance D->Deposit W->Withdrawal If transaction type is deposit call the credit(int amount) and update balance in this method. If transaction type is withdraw call debit(int amt) and update balance. Pass the other information like Account no,name,Account Type through constructor. Call the show data method to display the values.

1 Answers   Cognizant,






How to Create Files by Using the FileInfo Class?

1 Answers  


how can i split sting in textbox in windows application using c# .net

2 Answers  


program to reverse the order of digits in a given number of any length.

1 Answers   Mind Tree,


Write a program to count the number of characters, number of words, number of line in file.

2 Answers   Mind Tree,


Hello I am hosting remoting within IIS. Everything works just fine as long as I allow anonymous access at the IIS level. When I allow only Windows Authenticated sessions, something very strange happens: If the client activates the remote object with IP address - works fine If the client activates it using a machine name - get http 401 exception is thrown. The exception is thrown when the client calls the remote method. I set the channel's useDefaultCredentials property to true. Any idea how to allow Windows Authentication? Here is the call stack: System.Net.WebException: The remote server returned an error: (401) Unauthorized .. ---> System.ComponentModel.Win32Exception: The target principal name is incorrect at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean handshakeComplete) at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob, Boolean handshakeComplete) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials) at System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials) at System.Net.AuthenticationState.AttemptAuthenticate (HttpWebRequest httpWebRequest, ICredentials authInfo) --- End of inner exception stack trace ---

0 Answers   Infosys,


Code for Working with Files under a Directory?

1 Answers  


Code for Reading and writing from a file in 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)