HuseyinGuler 0 Newbie Poster

Hi,
Filling treeview database of stored data. but as the sum of the data childNode parentNode is increasing. To give some examples;

+ Products
- Bread
+ Products
- Tomato

I have a problem, as above.
+ + Products
- Bread
- Domat want to be like. My code is below.
SqlCommand com = new SqlCommand();
com.CommandType = CommandType.StoredProcedure;
com.CommandText = "pr_TreeviewControls";
com.Connection = cn_SystemConnection.cn;
cn_SystemConnection.cn.Close();
cn_SystemConnection.cn.Open();
SqlDataAdapter adapter = new SqlDataAdapter(com.CommandText, com.Connection);
DataTable table = new DataTable("Unite");
adapter.Fill(table);
if (table.Rows.Count > 0)
{
TreeNode rootNode = tree_Doc.Nodes.Add("MAEH KALİTE DÖKÜMANLARI");
for (int i = 0; i
{
TreeNode parentNode = rootNode.Nodes.Add(table.Rows["Birim"].ToString(), table.Rows["Birim"].ToString(),Convert.ToInt32( table.Rows["BirimID"].ToString()));
TreeNode childNode = parentNode.Nodes.Add(table.Rows["KayitAdi"].ToString(), table.Rows["KayitAdi"].ToString(), Convert.ToInt32(table.Rows["KayitTurID"].ToString()));
}
tree_Doc.Nodes.Add(rootNode);
cn_SystemConnection.cn.Close();
com.Parameters.Clear();


Thanks..