TreeView woes in VS2005

Discussion in 'ASP .Net' started by Josh, Jun 18, 2007.

  1. Josh

    Josh Guest

    Hi,

    I'm trying to use the standard TreeView in VS2005 ( under the navigation
    menu ). But I cant get any events to postback and none of the style
    settings are being applied. None of the property settings seem to be
    working either. The "ShowLines" property ( and others ) is working in the
    designer but not when the page renders

    I must be missing something simple, but for the life of me, I cant see what
    it is.

    HELP!
     
    Josh, Jun 18, 2007
    #1
    1. Advertising

  2. Josh

    Mark Rae Guest

    "Josh" <> wrote in message
    news:...

    > I'm trying to use the standard TreeView in VS2005 ( under the navigation
    > menu ). But I cant get any events to postback and none of the style
    > settings are being applied. None of the property settings seem to be
    > working either. The "ShowLines" property ( and others ) is working in the
    > designer but not when the page renders
    >
    > I must be missing something simple, but for the life of me, I cant see
    > what it is.


    What you've actually forgotten to do is post your code so that we can help
    you...


    --
    http://www.markrae.net
     
    Mark Rae, Jun 18, 2007
    #2
    1. Advertising

  3. Josh

    Josh Guest

    > What you've actually forgotten to do is post your code so that we can help
    > you...


    Heres what I'm doing to populatethe node. They all appear. The doPostBack
    is running but no server side event fires.

    private void loadMenu()

    {

    //clear up any existing nodes

    TreeView1.Nodes.Clear();



    // get the data for the nodes

    SqlStatement query = new StoredProcedure(@"SelectMenu");

    DataTable table = query.ExecuteDataTable();



    // process each parent tree node

    foreach (DataRow dr in table.Rows)

    {

    if (dr["biParentSiteMapNodeID"] == DBNull.Value)

    {

    TreeNode tn = new TreeNode(dr["vcTitle"].ToString(),
    dr["biSiteMapNodeId"].ToString());

    AddChildMenuNodes(tn,table);

    TreeView1.Nodes.Add(tn);

    }

    }





    }



    /// <summary>

    /// recursive function to populate tree nodes

    /// </summary>

    /// <param name="tn">parent tree node</param>

    /// <param name="dt">complete datatable of all menu nodes</param>

    private void AddChildMenuNodes(TreeNode tn, DataTable dt)

    {

    int parentID = Convert.ToInt32(tn.Value); // parent id for who's
    children we are looking



    foreach (DataRow dr in dt.Rows)

    {

    if (dr["biParentSiteMapNodeID"] != DBNull.Value)

    {

    if (Convert.ToInt32(dr["biParentSiteMapNodeID"]) ==
    parentID)

    {

    TreeNode newTreeNode = new
    TreeNode(dr["vcTitle"].ToString(), dr["biSiteMapNodeId"].ToString());

    AddChildMenuNodes(newTreeNode, dt);

    tn.ChildNodes.Add(newTreeNode);

    }

    }

    }

    }
     
    Josh, Jun 18, 2007
    #3
  4. Josh

    Mark Rae Guest

    Mark Rae, Jun 18, 2007
    #4
  5. Josh

    Josh Guest

    > Hmm - well, unless I'm missing something, I can't actually see a
    > server-side event such as SelectedNodeChanged...


    Actually theres no code in it to show, because its' not firing!
     
    Josh, Jun 19, 2007
    #5
  6. Josh

    Mark Rae Guest

    "Josh" <> wrote in message
    news:%...

    >> Hmm - well, unless I'm missing something, I can't actually see a
    >> server-side event such as SelectedNodeChanged...

    >
    > Actually theres no code in it to show, because its' not firing!


    Er, well, two possibilities, then...

    1) you don't have the property set (correctly) in your webcontrol tag...

    2) the event hasn't been wired up...


    --
    http://www.markrae.net
     
    Mark Rae, Jun 19, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VHltYm93?=
    Replies:
    2
    Views:
    24,633
    =?Utf-8?B?VHltYm93?=
    Jan 10, 2006
  2. Charlie@CBFC
    Replies:
    0
    Views:
    353
    Charlie@CBFC
    Jan 5, 2007
  3. pbd22
    Replies:
    1
    Views:
    306
    pbd22
    Nov 19, 2007
  4. Buddy Robbins

    Problem with treeview control in VS2005

    Buddy Robbins, May 10, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    133
    Buddy Robbins
    May 10, 2006
  5. Ian

    Treeview styling woes

    Ian, Mar 4, 2010, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    1,134
Loading...

Share This Page