Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi,
 
I have an HTML table titled "Professional Training" which contains 3 text-boxes. The text later gets saved as data in my database. However, I want another "Professional Training" record added into database, with new data. So I take an add button which help the create another control. Please help me with how to create the new controls and how to insert the data into my database. Please. Please. Please.
 
<table class="TableWorkArea" border="1px" cellpadding="3" style="border-collapse: collapse">   <tr>
                  <td class="TableHeading" colspan="4">
                                    SECTION G : PROFESSIONAL TRAINING</td>
               </tr>
                 <tr>
                     <td class="TDLeftLabel" width="18%">
                                    Training On
                        </td>
                                <td class="TDRightInput" width="32%">
                                    <asp:TextBox runat="server" ID="txtTrainingOn"
                                           CssClass="TextBoxFixed" TabIndex="14" Width="196px"></asp:TextBox>
                                </td>
                             </tr>
                                <tr>
                                <td class="TDLeftLabel" width="18%">
                                  Training Duration
                                </td>
                                <td class="TDRightInput" width="32%">
                                   <asp:TextBox runat="server" ID="txtTrainingDuration"  CssClass="TextBoxFixed" TabIndex="14" Width="196px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="TDLeftLabel" width="18%">
                                    Other Info [If Any] 
                                </td>
                                <td class="TDRightInput" colspan="3">
                                    <asp:TextBox runat="server" ID="txtTraningOther" CssClass="TextBoxFixed"  Width="196px"></asp:TextBox>
                                   
                                </td>
                            </tr>
                            
                            <tr>
                                <td class="TDLeftLabel" colspan="4"><asp:Button ID="btnTraningAdd" runat="server" Text="Add" /></td>
                                
                            </tr>
                            <tr><td class="TDLeftLabel" style="padding-removed366px" colspan="4"><asp:Button ID="btnProfessionalTrainingSave" runat="server" Text="Continue" />
                                <asp:Button ID="btnProfessionalTrainingEdit" runat="server" Text="Edit" /></td></tr>
                             </table>
 
Posted 26-Jan-13 22:15pm
Edited 26-Jan-13 23:18pm
Ed Nutting34.8K
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Please help me with how to create the new controls and how to insert the data into my database
Following should be the add/edit page design:
1. Have a single page design (lets say as above)
2. Based on the need, use the same design for add as well as edit.
3. If you have 'add' need, then show the above page with everything blank. On submit, save the data in DB and move on
4. If you have 'edit' need, then show the same page filled with the data. On submit, save the changed data back in DB and move on.
In case of edit, you will have a unique ID number to track it. In case of add, you don't need any ID.
 
Try out.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.141022.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100