Click here to Skip to main content
14,982,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

ASP.NET
<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
Updated 26-Jan-13 23:18pm
v2

1 solution

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.
   

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900