Accessing user control properties

Discussion in 'ASP .Net' started by David, Apr 12, 2007.

  1. David

    David Guest

    Hi,

    I have a user control that creates a menu structure, based on folders. I
    also have another user control that creates sub menu based on files within
    those folders.

    I need to bring them togethor...

    In my folder UC, I am dynamically generating the hyperlink, then adding it
    to a place holder. The same with the files UC.

    The Folder UC will then dynamically call the file UC for each folder.
    However, I need to pass the folder ID so that the files can be generated.

    I thought I had done something similar before, but I cannot find it in my
    code base. :-(

    Here is an example of what i mean...

    private void BuildFolders(int ParentFolder
    {
    try
    {
    foreach (FolderChild fd in Folders.GetFolders(ParentFolder))
    {
    HyperLink newLink = new HyperLink();
    newLink.Text = fd.DisplayName.ToString();
    newLink.NavigateUrl = fd.Path.ToString() + fd.HomePage.ToString();
    newLink.ToolTip = fd.Path.ToString();

    Literal BRTag = new Literal();
    BRTag.Text = "<br/>";

    MenuPlaceHolder.Controls.Add(newLink);
    MenuPlaceHolder.Controls.Add(BRTag);

    MenuPlaceHolder.Controls.Add(LoadControl("PagesInFolder.ascx"));

    BuildFolders(fd.FolderID);

    }
    }
    catch(Exception ex)
    {
    string exc = ex.Message;
    }

    }

    As you can see, just before the recursive call to BuildFolders, I am having
    a LoadControl. However, I need to pass the folder ID so that I render the
    correct pages. How can I do that?

    --
    Best regards,
    Dave Colliver.
    http://www.AshfieldFOCUS.com
    ~~
    http://www.FOCUSPortals.com - Local franchises available
     
    David, Apr 12, 2007
    #1
    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. Moe Sizlak
    Replies:
    4
    Views:
    413
    Moe Sizlak
    Jul 17, 2004
  2. Craig G
    Replies:
    3
    Views:
    732
    Craig G
    Nov 30, 2004
  3. tshad
    Replies:
    0
    Views:
    331
    tshad
    Aug 3, 2006
  4. Max2006
    Replies:
    2
    Views:
    517
    Max2006
    Jul 13, 2007
  5. Sumeet Mahajan

    User Control - Accessing Properties from the Container Page

    Sumeet Mahajan, Mar 2, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    123
    Sumeet Mahajan
    Mar 2, 2004
Loading...

Share This Page