Click here to Skip to main content
15,922,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, my question is:
I worte stored procedure like this:

SQL
create procedure Insert(@Name varchar,@DOB date,@RelationShip varchar,@Education varchar)
as
begin
Insert into Familydetails(Name,DOB,Relationship,Education) values(@Name,@DOB,@RelationShip,@Education)
end


In front end i have designed like this:

XML
<table class="style1">
           <tr>
               <td>
                   Name</td>
               <td>
                   DOB</td>
               <td>
                   Relationship</td>
               <td>
                   Education</td>
           </tr>
           <tr>
               <td>
                   <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
               </td>
           </tr>
           <tr>
               <td>
                   <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
               </td>
           </tr>
           <tr>
               <td>
                   <asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox10" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox11" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox12" runat="server"></asp:TextBox>
               </td>
           </tr>
           <tr>
               <td>
                   <asp:TextBox ID="TextBox13" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox14" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox15" runat="server"></asp:TextBox>
               </td>
               <td>
                   <asp:TextBox ID="TextBox16" runat="server"></asp:TextBox>
               </td>
           </tr>
           <tr>
               <td colspan="4" style="text-align: center">
                   <asp:Button ID="Button1" runat="server" Text="Submit" />
               </td>
           </tr>
       </table>



My scenario is I need to enter all the rows of (Name, DOB, Relationship,Education) of single family members and if i click on submit button all the details of family members should go to database table(FamilyDetails).


With Stored procedure how i need to call in front end.


Any help will be appreciated.
Posted
Updated 4-Sep-12 23:30pm
v2

 
Share this answer
 
Hi,

As per my understand you want to save one family details into the database. And as per design you are confused how to save the data.

I suggest to use gridview. In that you have to add ItemTemplate with text box. So when you click on submit, you can user for loop for the number of rows of the grid view and save all of then in the database.

I hope you will get some idea.

Thanks,
Viprat
 
Share this answer
 
Comments
narlakanti 6-Sep-12 7:50am    
Its not grid view. we need to design in a table and need to dump into database at a single click.
VIPR@T 6-Sep-12 7:56am    
i am telling you same thing. Not use table. Use gridview. Its possible some family has 15 members. At that what will you do? so i am suggesting this.
Hi,

See this example.
It will gives you idea what i want to say you.

http://www.aspsnippets.com/Articles/Adding-Dynamic-Rows-in-ASP.Net-GridView-Control-with-TextBoxes.aspx[^]

http://www.aspsnippets.com/Articles/Save-and-Retrieve-Dynamic-TextBox-values-in-GridView-to-SQL-Server-Database.aspx[^]

If you use this concept, then no need to create textboxes like this. If any family has 15 members then also you can manage all this things easily.

Thanks,
Viprat
 
Share this answer
 
v2
Comments
VIPR@T 6-Sep-12 8:14am    
Let me know you feedback on this? have you get the idea or not?
narlakanti 24-Sep-12 0:20am    
Hi Viprat..., thanks for your help. I have done with Inserting the values into database with you help. Now my question is, how can i update the family details data into database. From Gridview i need to select the Primary key ID of family details, and all the fields of family members need to appear into the text boxes for updation.


Please help me out in this scenario.
Thanks in advance.

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