locked
Adding webform controls from a console app! RRS feed

  • Question

  • Hey guys I was doing a project where it is required that I create a console application in Visual c# that would read in a text file and output a webform based on the contents of that file. So far I have been able to read the text file and get one word at a time however it is the linking to the website that is causing me some difficulty. I don't really know how you can dynamically create a webpage from a console app. I have read that programtically adding the controls may be one way but the code doesn't work in Visual c#, only web developer. Any assistance in this matter would be appreciated. Thank you!
    [code]
    string file_path = @"C:\Users\HyperMan\Desktop\demo.txt";
                StreamReader streamReader = new StreamReader(file_path);
                string text = streamReader.ReadToEnd();
                //Console.WriteLine(text);
                streamReader.Close();

                // separate individual items between commas
                string[] textFile = text.Split(new char[] { ',' });

                //Console.WriteLine("Each individual item: ");

                foreach (string word in textFile)
                {

                    switch (word)
                    {
                        case "text":
                            
                            break;

                        case "DDB":
                            //WHAT TO PUT HERE TO OUTPUT A DROPDOWNBOX IN A WEBPAGE??
                            break;

                        case "label":
                            //WHAT TO PUT HERE TO OUTPUT A LABEL IN A WEBPAGE??
                            break;

                        default:
                            Console.WriteLine(word);
                            break;
                    }
    [/code]
    • Moved by Rudedog2 Tuesday, November 24, 2009 8:54 PM asp.net is off-topic (From:Visual C# General)
    Tuesday, November 24, 2009 7:49 PM

Answers

  • I recommend you create a basic content management system.  Create a basic template using ASP.NET that has a few "content zones" that pull textual data from a database.  Leave the formatting up to the ASP.NET template to create a clear seperation between the display formatting and the actual content.  The console application can simply pump new data into the database and everytime you refresh the page it will poll the database for new data added by the console app.
    Good coding involves knowing one's logical limits and expanding them as necessary.
    • Marked as answer by Rudedog2 Tuesday, November 24, 2009 8:53 PM
    Tuesday, November 24, 2009 8:02 PM

All replies

  • I recommend you create a basic content management system.  Create a basic template using ASP.NET that has a few "content zones" that pull textual data from a database.  Leave the formatting up to the ASP.NET template to create a clear seperation between the display formatting and the actual content.  The console application can simply pump new data into the database and everytime you refresh the page it will poll the database for new data added by the console app.
    Good coding involves knowing one's logical limits and expanding them as necessary.
    • Marked as answer by Rudedog2 Tuesday, November 24, 2009 8:53 PM
    Tuesday, November 24, 2009 8:02 PM
  • Please ask question regarding dynamically generating web pages here, ASP.NET forum .

    Thanks ahead of time.

    Rudy   =8^D
    Mark the best replies as answers. "Fooling computers since 1971."
    Tuesday, November 24, 2009 8:53 PM