I have a form on which the user needs to enter a lot of medical information. Specifially there are three categories: injuries, activities, family history that need to be created dynamically. Under each category, the user is presented with a single row for
entering the required information, with an 'add another' button for additional info, something like this:
INJURIES
[textbox: Injury description] Button:Add Another
ACTIVITIES
[Dropdownlist: Avtivity type] [Dropdownlist: Intensity] [textbox: Frequency] Button: Add Another
FAMILY HISTORY
[Dropdownlist: Relation] [Dropdownlist: Disease] [Textbox: Age at Death] [Textbox: Cause of death] Button: Add Another
I am a complete beginner at OOP, c# and asp.net so please bear with me and explain it to me like I'm four years old :D
I can customise the gridviews well enough in the aspx page and suppose each gets its own ID, 'GridView1', 'GridView2', and 'GridView3' , but how do I modify the codebehind to accommodate three gridviews? Each of these will also bind to separate tables in
the db.
As you need three separate ones, you just need to create the different data table for the datasource of different GridView and use different ViewState to store the different status of each table. If I have misunderstood you, please feel free to let me know.
GopherJunkie
0 Points
1 Post
Multiple dynamic gridview tables on one page
Jun 28, 2012 10:44 AM|LINK
I have a form on which the user needs to enter a lot of medical information. Specifially there are three categories: injuries, activities, family history that need to be created dynamically. Under each category, the user is presented with a single row for entering the required information, with an 'add another' button for additional info, something like this:
INJURIES
[textbox: Injury description] Button:Add Another
ACTIVITIES
[Dropdownlist: Avtivity type] [Dropdownlist: Intensity] [textbox: Frequency] Button: Add Another
FAMILY HISTORY
[Dropdownlist: Relation] [Dropdownlist: Disease] [Textbox: Age at Death] [Textbox: Cause of death] Button: Add Another
I found this code: http://shibashishdotnetocean.blogspot.com/2012/02/adding-dynamic-rows-in-aspnet-gridview.html that does what I need - but it only shows how to do one gridview table on the page, wheras I need three separate ones.
I am a complete beginner at OOP, c# and asp.net so please bear with me and explain it to me like I'm four years old :D
I can customise the gridviews well enough in the aspx page and suppose each gets its own ID, 'GridView1', 'GridView2', and 'GridView3' , but how do I modify the codebehind to accommodate three gridviews? Each of these will also bind to separate tables in the db.
Sage Gu - MS...
Contributor
6693 Points
578 Posts
Microsoft
Re: Multiple dynamic gridview tables on one page
Jul 05, 2012 10:43 AM|LINK
Hi Gopher Junkie,
Welome to ASP.NET Forum!
As you need three separate ones, you just need to create the different data table for the datasource of different GridView and use different ViewState to store the different status of each table. If I have misunderstood you, please feel free to let me know.
Regards,
Sage Gu - MSFT
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework