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





Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 8/18/2006 9:48:23 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 16 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
mavilym
Asp.Net User
Treeview PostBack Problem8/18/2006 9:48:23 PM

0/0

I dont want my treeview control to postback if its SelectedNode not Changed. i mean; if you click over the selected item i dont want it to postback. how can i handle this. thanks for your help.
joteke
Asp.Net User
Re: Treeview PostBack Problem8/19/2006 9:20:36 AM

0/0

Hi,

with code like this, for example

    ''' <summary>
    ''' To store the path of last selected node
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Property LastSelectedNodeValuePath() As String
        Get
            Dim ret As String = ""
            If Not ViewState("LastSelectedNodeValuePath") Is Nothing Then
                ret = ViewState("LastSelectedNodeValuePath")
            End If
            Return ret
        End Get
        Set(ByVal value As String)
            ViewState("LastSelectedNodeValuePath") = value
        End Set
    End Property


    Protected Sub TreeView1_SelectedNodeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.SelectedNodeChanged
        'Change the select action of the last selected node
        If LastSelectedNodeValuePath <> "" Then
            TreeView1.FindNode(LastSelectedNodeValuePath).SelectAction = TreeNodeSelectAction.Select
        End If

        'Set the current selected node
        LastSelectedNodeValuePath = TreeView1.SelectedNode.ValuePath

        'Set current selected node's select action
        TreeView1.SelectedNode.SelectAction = TreeNodeSelectAction.None

    End Sub


Thanks,

Teemu Keiski
Finland, EU
mavilym
Asp.Net User
Re: Treeview PostBack Problem8/19/2006 12:40:44 PM

0/0

Hi, Thanks !!! it worked. :)
Here is the C# version that i used.

private string LastSelectedNodeValuePath
    {
        get
        {
            string ret = "";
            if (ViewState["LastSelectedNodeValuePath"] != null)
            {
                ret = ViewState["LastSelectedNodeValuePath"].ToString();
            }
            return ret;
        }
        set
        {
            ViewState["LastSelectedNodeValuePath"] = value;
        }
    }

protected void TreeView_cat_SelectedNodeChanged(object sender, EventArgs e)
    {
        //Change the select action of the last selected node
        if (LastSelectedNodeValuePath != "")
        {
            TreeView_cat.FindNode(LastSelectedNodeValuePath).SelectAction = TreeNodeSelectAction.Select;
        }
        //Set the current selected node
        LastSelectedNodeValuePath = TreeView_cat.SelectedNode.ValuePath;

        //Set current selected node's select action
        TreeView_cat.SelectedNode.SelectAction = TreeNodeSelectAction.None;
         ...
    }
3 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

Treeview updatepanel problem with AJAX - asp.net_ajax.asp.net_ajax_ui ... Treeview updatepanel problem with AJAX, > ROOT > NEWSGROUP > Asp.Net Forum > asp. ... printControls UpdatePanel; update panel + postback trigger problem; need ...
TreeView Postback Problems - ASP.NET Forums ... Master Pages, Themes and Navigation Controls " TreeView Postback Problems ... TreeView Postback Problems. Last post 08-05-2008 9:13 AM by davidov541. 2 ...
ComponentArt Forums - Show Post Re: TreeView problem on postback. Posted: 3/14/2008 2:31:12 AM. By: sandeep.mewara ... It seems tree view is unable to persist with the old state after the postback. ...
TreeView adapter problem - ASP.NET Forums ASP.NET Forums " Microsoft Downloads " CSS Friendly Control Adapters " TreeView adapter problem ... Adding postback support for checkmarks ...
ComponentArt Forums - Show Post Forums / Web.UI Product Forums / TreeView for ASP.NET. Posts. Treeview combobox postback problem. Posted: 3/2/2007 7:54:19 AM. By: peninsula_it. Hi all, ...
TreeView postback problem on Mozilla Firefox browser - Chat About It ... DotNetNuke® Forums ... TreeView postback problem on Mozilla Firefox browser. Previous. Next. 5/23/2007 4:13 AM ... am using Microsoft treeview control in my ...



 
All Times Are GMT