In this blog we will know how to edit update insert delete and cancel using button in form view.
Web.config file
<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Test.mdf;Integrated
Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default"
%>
<!DOCTYPE html
PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form
id="form1"
runat="server">
<div>
<asp:FormView ID="FormView1"
runat="server"
CellPadding="4"
ForeColor="#333333"
DataKeyNames="AutoID" DataSourceID="SqlDataSource1" AllowPaging="true">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<PagerStyle BackColor="#2461BF"
ForeColor="White"
HorizontalAlign="Center"
/>
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
<table border="1">
<tr>
<td>AutoID</td>
<td><%# Eval("AutoID")
%></td>
</tr>
<tr>
<td>Name</td>
<td><%# Eval("Name")
%></td>
</tr>
<tr>
<td>Address</td>
<td><%# Eval("Address")
%></td>
</tr>
<tr>
<td>Phone</td>
<td><%# Eval("Phone")
%></td>
</tr>
<tr>
<td>City</td>
<td><%# Eval("City")
%></td>
</tr>
<tr>
<td> </td>
<td>
<asp:Button ID="btnEdit" runat="Server" CommandName="Edit" Text="Edit" />
<asp:Button ID="btnInsert" runat="Server" CommandName="New" Text="New" />
<asp:Button ID="btnDelete" runat="Server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure to Delete?');"
/>
</td>
</tr>
</table>
</ItemTemplate>
<EditItemTemplate>
<table border="1">
<tr>
<td>AutoID</td>
<td><%# Eval("AutoID")
%></td>
</tr>
<tr>
<td>Name</td>
<td><asp:TextBox ID="TextBox1" runat="Server" Text='<%#
Bind("Name")%>'></asp:TextBox></td>
</tr>
<tr>
<td>Address</td>

Vicky VishalPosted Dec 19, 2012, 9:49 PM
plz some one provide code for registration validation page.......and how log-in page retrieve username & password from the database.....
dana lonPosted Dec 4, 2012, 10:57 PM
Whe I insert a record I get an error!