Click here to Skip to main content
12,358,699 members (75,847 online)
Rate this:
 
Please Sign up or sign in to vote.
Hi,
I am using asp.net,c#.net and sql server.

I am using details-view like below design.
I want to insert values using details-view into database using Insert-mode.

Can anyone tell me the code behind how to achieve this.

Below is my Details-view aspx code.

<form id="form1"  runat="server">
    <div align="center">
     <asp:DetailsView ID="CustomerDetailView" AutoGenerateRows="False" 
            AllowPaging="True" DefaultMode="Insert" runat="server" onitemcommand="CustomerDetailView_ItemCommand" DataSourceID="SqlDataSource1" 
            oniteminserting="CustomerDetailView_ItemInserting">   
 
        <Fields>              
                <asp:TemplateField HeaderText="Cust Name">                
                    <ItemTemplate>
                        <asp:TextBox ID="txtPName" runat="server" Text='<%# Bind("CustomerName") %>'></asp:TextBox>

Can anyone help me how to insert data into Database after clicking SAVE button.

Thank you,
Posted 13-Jul-12 1:05am

1 solution

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160621.1 | Last Updated 9 Nov 2012
Copyright © CodeProject, 1999-2016
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