locked
how to add a Gridview to a Core Console app? RRS feed

  • Question

  • User2142845853 posted

    Have a console app made in Core, over 20,000 loc, 100s of methods.  big.

    Need to add in another project such as web forms and use the Gridview control.  Version does not matter, added a project that defaults to the old NON Core asp.net 4.7.2

    Using the default.aspx.cs page, or could be any page, added a Gridview.

     Now in one of the functions within the console app it produces data that can be parsed out    string val1 = blob.var1 string val2 = blob.var2  string val3 = blob.var3

    those can be put into some enumerable list and dumped into a row on the grid, then go back and get another row and dump that row in then do this over and over until the end is reached

    Problem:  while everything is isolated, I added the new project into the same namespace.  need to be able to "find" the gridview control and add to it from the console app.

    alternative is make one big web project;  another problem is I dont know how Core is different, there are new files, new things, and dont know their purpose and it appears incompatible

    how to do this?   adding a gridview to a console app's output.  Oh sure thats easy. or maybe not

    Saturday, May 1, 2021 9:54 PM

Answers

  • User475983607 posted

    Console and Web Applications are separate domains.  If you have code in a Web Application that you want to use in a Console application or visa versa, then create a separate class library project and move the code to this library.   The Console and Web Application reference the shared the library not each other.  

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 2, 2021 11:42 AM

All replies

  • User475983607 posted

    how to do this? 

    Typically, the data is stored in a database table which each project can access.

    Saturday, May 1, 2021 10:23 PM
  • User2142845853 posted

    I know, this one stumped me too

    Saturday, May 1, 2021 10:36 PM
  • User475983607 posted

    I know, this one stumped me too

    I'm a little confused by your response.  Should I assume you are unable to use a database?  

    Passing data between applications is not a new idea.  If you cannot use a database then a file will work.  There are other ways like sockets etc.  

    Saturday, May 1, 2021 10:49 PM
  • User2142845853 posted

    Was hoping to use the windows gridview not javascript/MVC.  but maybe thats how it has to be to overcome design limitations in asp.net

    When there is a Solution with namespace called: "ABCD"  and you add a new project to the solution and make sure its namespace is called "ABCD" ?  They cannot see each other.  I assumed they could if the Namespace name was identical.

    Project 1

    Namespace ABCD {

    class xyz{}

    }

    Namespace ABCD {

    class zzy {}

    }

    class zzy and class xyz are isolated and cannot interact.  This has 

    Namespace ABCD.One

    Namespace ABCD.Two

    Namespace ABCD.Three

    in the new project

    Using Namespace ABCD;  <==error no such namespace

    solution -> add -> existing project... ?  error: project is already part of the solution

    Saturday, May 1, 2021 11:15 PM
  • User475983607 posted

    Console and Web Applications are separate domains.  If you have code in a Web Application that you want to use in a Console application or visa versa, then create a separate class library project and move the code to this library.   The Console and Web Application reference the shared the library not each other.  

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, May 2, 2021 11:42 AM