Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ways to create table

ways to create table

Scheduled Pinned Locked Moved ASP.NET
databasequestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexfromto
    wrote on last edited by
    #1

    Hi. I have a web page, which collects information about project (name, project date create, description, project date due, etc). One of the things I need to collect is the "project assigned to" information. For this purpose I need to build a table or any other structure that can support the following: 1. the table should have 5 rows as default 2. the table should have ability to add/remove rows if needed 3. the table will consist of 2 cell. a. Role - dynamic drop-down (data will be populated from db) b. Name - text field 4. adding/removing rows should not affect data entered in other fields. Basically if I filled all 5 rows and want to add sixth row my data will be there with new row added. The same goes for removing rows (I guess this is something had to do with State). I've tried different things (datatable and datagrid) but couldn't complete all 4 point described above. Did anyone had experience with something like this or have any suggestions? Thank you, Alex.

    M 1 Reply Last reply
    0
    • A alexfromto

      Hi. I have a web page, which collects information about project (name, project date create, description, project date due, etc). One of the things I need to collect is the "project assigned to" information. For this purpose I need to build a table or any other structure that can support the following: 1. the table should have 5 rows as default 2. the table should have ability to add/remove rows if needed 3. the table will consist of 2 cell. a. Role - dynamic drop-down (data will be populated from db) b. Name - text field 4. adding/removing rows should not affect data entered in other fields. Basically if I filled all 5 rows and want to add sixth row my data will be there with new row added. The same goes for removing rows (I guess this is something had to do with State). I've tried different things (datatable and datagrid) but couldn't complete all 4 point described above. Did anyone had experience with something like this or have any suggestions? Thank you, Alex.

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      alexfromto wrote:

      3. the table will consist of 2 cell.

      you mean, two columns? I think that those facts are pretty okay with DataGrid. I have done something like that with Datagrid in ASP.NET 1.1...

      alexfromto wrote:

      1. the table should have 5 rows as default

      you can bind with the empty dataset to your datagrid.

      alexfromto wrote:

      2. the table should have ability to add/remove rows if needed

      For adding row, I used the footer template in Datagrid. For removing row, I added the "Delete" link with command in grid template.

      alexfromto wrote:

      a. Role - dynamic drop-down (data will be populated from db) b. Name - text field

      ItemTemplate is pretty okay for you. it allows you to add any web control (including dropdown ctl and textbox control) in Datagrid.

      alexfromto wrote:

      4. adding/removing rows should not affect data entered in other fields. Basically if I filled all 5 rows and want to add sixth row my data will be there with new row added. The same goes for removing rows

      Yeah. It is very okay with Datagrid item template. but if you do some action, the postback will be occured.

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

      A 1 Reply Last reply
      0
      • M Michael Sync

        alexfromto wrote:

        3. the table will consist of 2 cell.

        you mean, two columns? I think that those facts are pretty okay with DataGrid. I have done something like that with Datagrid in ASP.NET 1.1...

        alexfromto wrote:

        1. the table should have 5 rows as default

        you can bind with the empty dataset to your datagrid.

        alexfromto wrote:

        2. the table should have ability to add/remove rows if needed

        For adding row, I used the footer template in Datagrid. For removing row, I added the "Delete" link with command in grid template.

        alexfromto wrote:

        a. Role - dynamic drop-down (data will be populated from db) b. Name - text field

        ItemTemplate is pretty okay for you. it allows you to add any web control (including dropdown ctl and textbox control) in Datagrid.

        alexfromto wrote:

        4. adding/removing rows should not affect data entered in other fields. Basically if I filled all 5 rows and want to add sixth row my data will be there with new row added. The same goes for removing rows

        Yeah. It is very okay with Datagrid item template. but if you do some action, the postback will be occured.

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

        A Offline
        A Offline
        alexfromto
        wrote on last edited by
        #3

        Yes. I mean 2 columns. 1. I have no problem creating DataGrid. How can I assign empty DataSet to DataGrid. I've built a table (5 rows) with empty cell and added to my DataGrid. Is this the way of doing it? 2. Do you have anything code wise so I can see how add/remove works? 3. I did it and had no problem 4. didn't get exactly what you mean here. Will I lose data entered or datagrid will keep it? Thanks a lot

        A 1 Reply Last reply
        0
        • A alexfromto

          Yes. I mean 2 columns. 1. I have no problem creating DataGrid. How can I assign empty DataSet to DataGrid. I've built a table (5 rows) with empty cell and added to my DataGrid. Is this the way of doing it? 2. Do you have anything code wise so I can see how add/remove works? 3. I did it and had no problem 4. didn't get exactly what you mean here. Will I lose data entered or datagrid will keep it? Thanks a lot

          A Offline
          A Offline
          alexfromto
          wrote on last edited by
          #4

          OK. Firgure it out. Wow. Yeah.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups