protected void Page_Load(object sender, EventArgs e)
{
if (!ScriptManager.GetCurrent(this).IsInAsyncPostBack)
{
trvWetTekst.Nodes.Clear();
PopulateMenu();
}
else
{
//code when it is an async postback
trvWetTekst.Nodes.Clear();
PopulateMenu();
}
}
You don't need to clear and recreate treeview items on page postbacks. Control state will be retained across partial page updates and full page postbacks as well. If you wrap that treeview loading logic within if(!IsPostBack), your code should work fine. As you are clearing the items, you will lose the selection as well. That's why DetailsView is not being refreshed no matter what you select in the treeview
Member
7 Points
48 Posts
No updatemode with detailview in updatepanel
Mar 15, 2014 03:21 PM|Mark Kooijman|LINK
Hello,
I have a detail view in a updatepanel. The trigger is a treeview. When i want to update the data a can't see anything.
*.aspx
*.aspx.cs
How do I get the updatemode working.
Kind regards Mark
Contributor
5590 Points
1297 Posts
Re: No updatemode with detailview in updatepanel
Mar 16, 2014 04:33 AM|dotnetzoom|LINK
You don't need to clear and recreate treeview items on page postbacks. Control state will be retained across partial page updates and full page postbacks as well. If you wrap that treeview loading logic within if(!IsPostBack), your code should work fine. As you are clearing the items, you will lose the selection as well. That's why DetailsView is not being refreshed no matter what you select in the treeview
Also, you don't need to clear TreeView items across page postbacks. Try above approach and see if it works.
Member
7 Points
48 Posts
Re: No updatemode with detailview in updatepanel
Mar 16, 2014 03:48 PM|Mark Kooijman|LINK
Hello, This solution did not work.
This was the solution.