I need to produce a from where I can add multiple parts. Each time a user enters a part number, the description should be populated. The user can then click add and this part and description will be shown below. They have the option to add as many parts as they require. Once all parts are added the user fills in some general info eg description and then once a submit button is clicked all part info will be inserted into a table and general info will be inserted into another table with one unique ID. Can anyone point me in the right direction.
Adding Multiple Rows, Displaying Session Rows and then doing one insert
Collapse
X
-
This question is way to big.
I don't have any idea of "which direction" you need to be pointed in.
What have you done so far to solve the problem?
Did you create a form? Do you know how to?
Did you add the controls that you need in order gather the information from the user on to the form? Do you know how to?
Did you try to gather the information? Do you know how to?
Are you having problems updating the database??
Please attempt to implement this application and when you have a specific question ask it. We can't answer "I want to write a program...how?" but we can answer "I have a TextBox on the page. How do I retrieve the text the user entered from it"
-Frinny -
I have a form with 5 part related fields. Part No, Description Cost, Quantity and Total Cost. A user will enter a part no, a query will run and the description and cost will be populated. The user then enters the quantity and a calculation works out the total cost. I have this all working. There is then a comments field but this applies to all parts submitted on this session. I can insert this data into a table without any problem. My problem is - how do I allow the user to enter multiple parts - display them on the page as they enter them - they then enter details into the comments field and then hit the submit button to submit all part details and the comments field all related to a unique id, eg order number. I'm not sure how to store the part details before submitting to the database and how to allocate a unique id to all aspects. Do I need to submit code?This question is way to big.
I don't have any idea of "which direction" you need to be pointed in.
What have you done so far to solve the problem?
Did you create a form? Do you know how to?
Did you add the controls that you need in order gather the information from the user on to the form? Do you know how to?
Did you try to gather the information? Do you know how to?
Are you having problems updating the database??
Please attempt to implement this application and when you have a specific question ask it. We can't answer "I want to write a program...how?" but we can answer "I have a TextBox on the page. How do I retrieve the text the user entered from it"
-FrinnyComment
-
Ohhh I understand your question now.
There are a few approaches to this that you can take.
I think I'd be more inclined to suggest that you look into creating a Templated Control rather than using something like a GridView or a Repeater (but maybe that's just because I think they're cool).
Basically you're going to create a class that represents your "PartOrder" .
This class is going to have:- A Public Part Number Property
- A Public Description Property
- A Public Cost Property
- A Public Quantity Property
- A Public Total Cost Function (or ReadOnly Property) that calculates the total cost based on the quantity and cost properties
- Some private validation methods if needed and maybe an IsValid Public function (or ReadOnly Property) so that you can check validation
- And maybe a public Update method that updates the database...if you want
You will have a collection of the "PartOrder" class which it will use as the Data Source.
You could either bind this collection to your Templated Control or you can bind this collection to a GridView or a Repeater control.
Which ever way you chose to do this you're going to need to use a "Template" to specify how your data is displayed to the user.
If you use a GridView then you'll use one or more TemplateFields. In the TemplateField you can specify how your PartOrder is displayed to the user during "viewing" and during "editing". You can use different controls for each purpose.
I'm not sure what direction you're going to choose so let me know which you prefer before I start getting into more details about other options.
-FrinnyComment
Comment