ArrayList and Tab Control

Last post 05-05-2008 11:27 AM by Jonathan Shen – MSFT. 2 replies.

Sort Posts:

  • ArrayList and Tab Control

    04-30-2008, 12:38 PM
    • Member
      6 point Member
    • LEHayes
    • Member since 02-19-2007, 7:35 AM
    • Posts 13

    I have an arraylist that consists of files from a folder.  I want to put the name of the files on the tabs of the tab control and the contents of the files (htm's) on the tab content page.  Can you help me out?  Here is what I have so far:

     

     

        string[] arrFileNames;
        int NumFiles;
        protected void Page_Load(object sender, EventArgs e)
        {
            //LEH_Trend_043008_0016
            string FPath = Server.MapPath("reports");
            ArrayList Files = new ArrayList();
            foreach (string mFile in Directory.GetFiles(FPath))
            {
                FileInfo mFileInfo = new FileInfo(mFile);
                if (mFileInfo.Exists)
                {
                    Files.Add(mFileInfo.Name);
                }
            }
            Files.
            foreach (object MyFile in Files)
            {
                TabContainer1.Tabs.Add(MyFile.ToString());
            }
    
        }

     The Tab container is expecting a control child as the parameter, how do I make it happy?

    Note: I am on Win2k so I cannot use AJAX 3.5, have to do without linq.

  • Re: ArrayList and Tab Control

    04-30-2008, 7:03 PM
    • Participant
      1,339 point Participant
    • santosh.singh
    • Member since 12-03-2007, 6:11 PM
    • India
    • Posts 240

    hi check this link  

     

    http://aspdotnetcodebook.blogspot.com/2008/04/aspnet-ajax-tabs-control.html 

    Santosh kumar
    Mark as Answer on the post that helped you.



    Blog
  • Re: ArrayList and Tab Control

    05-05-2008, 11:27 AM

    Hi LEHayes,

    LEHayes:
    TabContainer1.Tabs.Add(MyFile.ToString());

    TabContainer1.Tabs.Add( here should be a TabPanel but not string object);  To achieve your goal, you should find the TabPanels and set their HeaderText property to file names and add Panels to the TabContainer's ContentTemplate, and then add your file content to the Panels. However, TabContainer is not recommended to be used like this.  When the file is huge, your TabContainer will be  horrible.

    Best regards,

    Jonathan

    Jonathan Shen
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (3 items)