How to accomplish this programmatically - ASP.Net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geo039
    New Member
    • Nov 2006
    • 47

    How to accomplish this programmatically - ASP.Net

    Here's what I need to do, I have two tables bldgloc (bldg_id, bldg_desc) and roomloc (room_id, room_num, bldg_id). I am trying to build a maintenance screen so that the user can add a bldg or a room. I picture the user selecting the bldg from a list which would then populate all the rooms. When they add room it should be added to the id of the bldg selected.

    I'm a beginner and have tried a few things with gridview but can't seem to get things to work.

    I am hoping you guys can give me suggestions on how (in the simplest way possible) I could accomplish the above.

    Thanks
  • nateraaaa
    Recognized Expert Contributor
    • May 2007
    • 664

    #2
    Originally posted by geo039
    Here's what I need to do, I have two tables bldgloc (bldg_id, bldg_desc) and roomloc (room_id, room_num, bldg_id). I am trying to build a maintenance screen so that the user can add a bldg or a room. I picture the user selecting the bldg from a list which would then populate all the rooms. When they add room it should be added to the id of the bldg selected.

    I'm a beginner and have tried a few things with gridview but can't seem to get things to work.

    I am hoping you guys can give me suggestions on how (in the simplest way possible) I could accomplish the above.

    Thanks
    I would recommend giving the user a drop down list with the building ids. Then allow them to search for the rooms within that building by clicking a search button. Display the results in a gridview. On your gridview you will want to add a Button that will allow you to enter a new room for the building. There are several ways that you can do this.
    1. You can redirect or pop up a new page that will allow the user to enter the data for the new room and save (call insert stored procedure).
    2. You can allow the user to add the new room within the grid view. See example .

    Make sure that you rebind the gridview after the new data has been inserted into the database.

    Nathan

    Comment

    • geo039
      New Member
      • Nov 2006
      • 47

      #3
      Actually I have that page you showed built for the rooms updating, I just got stuck on some of the C# syntax since i'm in VB but switched gears to work on the grid for bldgs. I am working on this one http://www.gridviewguy .com/ArticleDetails. aspx?articleID= 98

      However, I don't know how to handle the fact that bldg_id can't be null. I keep getting record cannot be added because nulls aren't allowed??

      Comment

      • nateraaaa
        Recognized Expert Contributor
        • May 2007
        • 664

        #4
        Originally posted by geo039
        Actually I have that page you showed built for the rooms updating, I just got stuck on some of the C# syntax since i'm in VB but switched gears to work on the grid for bldgs. I am working on this one http://www.gridviewguy .com/ArticleDetails. aspx?articleID= 98

        However, I don't know how to handle the fact that bldg_id can't be null. I keep getting record cannot be added because nulls aren't allowed??
        Your insert proc should have some type of IDENTITY column that automatically creates the next bldg_id for a new row. Is there something like this in the insert proc?

        Nathan

        Comment

        Working...