Note that there are some explanatory texts on larger screens.

plurals
  1. POTreeview Loading Issue
    primarykey
    data
    text
    <p>I am using TreeView in my project to hierarchical display of my data from database. It works fine for small amount of data, say 500 entries. But when it exceeds that number of entries, it is taking too much time for loading. I have to populate large amount of data (say 2500 entries). I have one table named as "tRegistered" from where I bind "Date" column as treeview Parent Node. And again from the same table I bind "Users" column as treeview Node. My objective is to display all registered users for the last 7 days in a hierarchical way. Please help me how do I proceed.</p> <p>My code is:</p> <pre><code>private void PopulateTreeView() { treeView1.Nodes.Clear(); SqlDataAdapter daPatient = new SqlDataAdapter("SELECT TOP 100 PERCENT pId, pDate, pName FROM tRegistered WHERE pDate &gt;= DATEADD(day,-7, GETDATE())", con); SqlDataAdapter daDate = new SqlDataAdapter("SELECT TOP 100 PERCENT pDate FROM tRegistered WHERE pDate &gt;= DATEADD(day, - 7, GETDATE())) GROUP BY pDate ORDER BY pDate DESC", con); DataSet ds = new DataSet(); daPatient.Fill(ds, "tRegistered"); daDate.Fill(ds, "tRegistered"); //Add root node TreeNode root = new TreeNode("Registered"); treeView1.Nodes.Add(root); //Hard code ds.Relations.Add("Regsd", ds.Tables["tRegistered"].Columns["pDate"], ds.Tables["tRegistered"].Columns["pDate"]); foreach (DataRow dr in ds.Tables["tRegistered"].Rows) { DateTime dt = Convert.ToDateTime(dr["pDate"]); TreeNode tn = new TreeNode(String.Format("{0:dd-MMM-yyyy}", dt)); foreach (DataRow drChild in dr.GetChildRows("Regsd")) { TreeNode childTn = new TreeNode(drChild["pId"].ToString() + "- " + drChild["pName"].ToString()); childTn.Tag = drChild["pId"]; tn.Nodes.Add(childTn); } root.Nodes.Add(tn); root.Expand(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload