Click here to Skip to main content
12,623,027 members (37,159 online)
Rate this:
Please Sign up or sign in to vote.
I am using, 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" 
                <asp:TemplateField HeaderText="Cust Name">                
                        <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 2: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
Web02 | 2.8.161128.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