c# - How to generate a treeview with group format? ( Letter that indicate the starting word ) -


I am developing an ASP.NET website and there is a previewview to display countries that are stored in MYSQL DB Are there.

I am using this code to bind the data in the tree view.

dt_Record is a datat.

  Private Zero get_Countries () {try {dt_Record.Clear (); Dt_Record = objCommonMethods_Bll.Get_Countries (); If (dt_Record.Rows.Count! = 0) {foreach (DataRow dr in dt_record.rows) {TreeNode node = new triode (); Node Text = dr ["name"]. ToString (); Node Value = dr ["country_id"]. Toasting (); TvCountries.Nodes.Add (node); }}} Hold (exception) {throw; }}  

then it displays such countries

But I want to display such countries. Can not click with group letter to easily identify initial letter.

Enter image details here

Do I get the format Can i do

I did it using LINQ query but in my case I have a user Datasractor is but you can use the database in your scenario. This is my code:

1) I have created a class to use it as a table.

  public class country {public string name {get; Set; }}  

2) I have created a list with data, and amp; In your case you are receiving data from your database.

  list & lt; Country & gt; New country {name = "Benin"}, new country {name = "botswana"}, new country {name = "Algeria"}, new country {name = "Angola"}, new country {name = "Benin"}, New country {name = "Burkina Faso"}, new country {name = "Burundi"}, new country {name = "Cameroon"}, new country {name = "Cape Verde"}}}; 3) And finally Link Curie has been written to get the data collected:  
  var temp = name [0] selection of GR New {key = gr.Key, value = gr.ToList ()}). ToList ();  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -