Refreshing TreeView

I

Ira

Hello .

I have a question about Microsoft TreeView Web Control .

How can I refresh the TreeView ?

I am getting TreeView Nodes from Microsoft Sqlserver database

I want to say that , I can`t refresh TreeView after adding a new row to
database

I can add a new Node using this

private void btnAddMenu_Click(object sender, System.EventArgs e)
{
TreeNode selected_node=new TreeNode();
selected_node=TreeView1.GetNodeFromIndex(TreeView1.SelectedNodeIndex.ToString());
string menu_name=Util.ClearStringForSql(txtAddUpdateMenu.Text);
// new node name from textbox
TreeNode node=new TreeNode();
node.Text=menu_name;
selected_node.Nodes.Add(node);

}

But, I don`t want to add new node like that sample .....

I want to add a new record to database and then refresh TreeView ...

But , I can`t ....

When I am adding a new record to database ,I cannot see new added Node in
treeview. How can I make it reload?

Can you help me?
Regards,
I.
 
P

Phillip Williams

If you have a TreeView whose DataSourceID is set to a DataSourceObject and
you updated the database then, I think, you can call the TreeView.DataBind()
in the codebehind to refresh the TreeView.
 
I

Ira

Hello,
I have DataSourceId and I set DataSourceObject - I actually implemeted all
HierarchicalDataSourceControl in my Control which I bound to the tree, but
TreeView.DataBind() doesnt work when I add additional data to the database.
It doesn't refresh the tree. Do you have any other ideas?
I.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top