CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 5/24/2006 2:20:02 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 69 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
HW@ITSOL
Asp.Net User
Treeview collapse/expand problem on postback5/24/2006 2:20:02 PM

0/0

hi all,

i read all day articles on this problem and i've tried many different solutions but none really solved my problem.

my situation :
- i have a treeview placed inside a panel, per default, this panel is hidden, when a user clicks on a linkbutton this panel is made visible.
- my treeview is been created from the code behind, because all items are loaded from a sql datasource
- my treeview has irregular nodes, sometimes the root has no child, in other cases it does have childes.

my problem :
- when a user clicks on a childnode, which is a hyperlink, the browser goes to that page and the treeview collapses. now i want that my treeview stay's open at the node where the child is located.

my page :

<asp:Panel runat="server" ID="pWines" Visible="false">
<asp:TreeView CssClass="winesubmenu" ID="tvWines" runat="server" NodeIndent="8" ExpandDepth="0">
</asp:TreeView>
</asp:Panel>

my code:
Protected Sub lbWine_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbWine.Click
If lbWine.CommandName = "Show" Then
   pWines.Visible = True
   lbWine.CommandName = "Hide"
   LoadWineCategories()
ElseIf lbWine.CommandName = "Hide" Then
   pWines.Visible = False
   lbWine.CommandName = "Show"
End If
End Sub

Private Sub LoadWineCategories()
   If Not tvWines.Nodes.Count > 0 Then
      Dim tnRoot As New TreeNode
      Dim tnChild As New TreeNode
      Dim dtCategories, dtSubCategories As DataTable
      Dim drCategory, drSubCategory As DataRow
      dtCategories = WS.GetWineCategories(Profile.Culture).Tables(0)
      For Each drCategory In dtCategories.Rows
         tnRoot =
New TreeNode
         tnRoot.Text = drCategory(
"Category")
         tnRoot.Value = drCategory(
"CID")
         If CType(drCategory("CHasChild"), Boolean) Then
            dtSubCategories = WS.GetWineSubCategories(Profile.Culture, drCategory("CID")).Tables(0)
            For Each drSubCategory In dtSubCategories.Rows
            tnChild =
New TreeNode
            tnChild.Text = drSubCategory(
"Category")
            tnChild.Value = drSubCategory(
"CID")
            tnChild.NavigateUrl =
String.Format("~/products/wines/{0}/{1}.aspx", shared_functions.CleanURL(drCategory("Category")), shared_functions.CleanURL(drSubCategory("Category")))
            tnRoot.ChildNodes.Add(tnChild)
            Next
         
Else
            tnRoot.NavigateUrl = String.Format("~/products/wines/{0}.aspx", shared_functions.CleanURL(drCategory("Category")))
         End If
         tvWines.Nodes.Add(tnRoot)
      Next
   End If
End Sub

Protected

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   If Not Page.IsPostBack Then
      CheckOnPostback()
   End If
End Sub

Private Sub CheckOnPostback()
   If Request.RawUrl.Contains("wines") Then
      LoadWineCategories()
      pWines.Visible =
True
   End If
End Sub

 

Face your fears, Live Your Dreams
haidar_bilal
Asp.Net User
Re: Treeview collapse/expand problem on postback5/28/2006 7:31:19 PM

0/0

You have to add some code to make your page preserve the location in the TreeView, you check this post of mine where I add this code:

Set Selection in TreeView - ASP.NET 2.0

HTH,

Regards


Bilal Hadiar, MCP, MCTS, MCPD, MCT
Microsoft MVP - Telerik MVP
HW@ITSOL
Asp.Net User
Re: Treeview collapse/expand problem on postback6/1/2006 9:16:57 AM

0/0

hi, thanks a lot for your reply and your blog post,

only thing i can't get true with is how and when you call the void on the content page...


Face your fears, Live Your Dreams
3 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP.NET 2.0 in VB 2005: special edition. Authors: Laurence Moroney, Matthew MacDonald, Pages: 1360, Published: 2006
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
ASP.NET 2.0: A Developer's Notebook Authors: Wei Meng Lee, Pages: 326, Published: 2005
Core Internet Application Development with ASP.NET 2.0 Authors: Randy Connolly, Pages: 1049, Published: 2007
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
Build Your Own ASP.NET 2.0 Web Site Using C# & VB: The Ultimate ASP.NET Begginner's Guide Authors: Cristian Darie, Zak Ruvalcaba, Pages: 689, Published: 2006
Pro ASP.NET Web Forms Techniques Authors: Alex Homer, Pages: 580, Published: 2003
Beginning ASP.NET in VB.NET: From Novice to Professional Authors: Matthew MacDonald, Pages: 983, Published: 2004
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007

Web:
How To Prevent TreeView from PostBack When Collapse/Expand? - Dev Shed How To Prevent TreeView from PostBack When Collapse/Expand?- .Net Development. Visit Dev Shed to discuss How To Prevent TreeView from PostBack When ...
Expand/Collapse of treeview node causes a postback on content page ... These two event will make the treeview postback when you expand / collapse the treenode, you can try to remove them. Hope it helps. ...
TreeView - disable postback for selectedindexchange - ASP.NET Forums Here is how I did it in Treeview.htc // commnented out to disable postback on expand/collapse // should post back only when leaf is clicked ...
TreeView - want node selection WITHOUT POSTBACK javascript:__doPostBack from the TreeView node expand or collapse image. I'm having the same problem. Is there any way to get rid of that ...
TreeView PostBack Problem - .NET TreeView PostBack Problem. Get answers to your questions in our .NET forum. ... PostBack on expand/collapse events? Just do it on selectedindexchanged. ...
How to expand/collapse treeview control without page postback ... Hi, I have two treeview controls, I want to collapse one of them when expand the other one,How to do that without page postback? I guess I should use client ...
Treeview saves the state on postback but does not collapse ... i have a small problem with the treeview and i cant figure it out .... to ch2) it does not expand and it does not collapse ch2. any idee? ...
MSDN Visual Studio Team System - Web and Load Testing Testing asp ... Testing asp.net 2 treeview ajax, event validation problem. ... Expand child node 2. It expands with no postback, but the child node 1 gets collapsed. ...
Ritesh Kesharwani: How to Maintain Tree view state after page post ... In the web application if page get post back then it's very difficult to maintain tree view .... //Record the TreeView's current expand/collapse state. ...
Essential Tools : Tree View Auto-postback Settings : Syncfusion Collapse Tree Package ... Tree View Auto-postback Settings. Auto-postback On Select ... Auto-postback On Node Expand Auto-postback On Node Collapse ...




Search This Site:










create a custom login view

need help with the daab and multiple databases.

project managment module within dnn

restoring a complete site.

dotnetnuke source code on gotdotnet??

why can aspx code access files outside the virtual directory? eg. program files

does anyone have a viewstate manager?

edit command in datagrid

server only works when localhost

dynamic title & meta tags

excempting pages from forms authentication

how to catch invalid urls to a deleted portal? 3.x

thread was being aborted

output opinion

asp.net 2.0 beta web app admin help

c:\dotnetnuke\controls\address.ascx.vb(28): 'countrylistbox' is ambiguous in the namespace 'dotnetnuke.web.ui.webcontrols'.

deployment of ie web controls

can't decrypt config section use default provider (aspnet_regiis -pe)

css files are references multiple times in the head tag

html editing module

don't display full paths in the window tabs?

horizontal treeview?

timeclock module

are any events fired when an editorzone updates personalization data?

incompatibilities in .net vs php encryptions

login page vanished

programmatic impersonation, ad authentication fails under server 2003

oracle provider for dnn 3.2

database db = databasefactory.createdatabase(); throws an exception.

why can i use a server tag in a createuserwizardstep contenttemplate but not in a changepasswordtemplate?

 
All Times Are GMT