Source Code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="8b.aspx.cs"
Inherits="_6A._8b" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataKeyNames="Id" DataSourceID="SqlDataSource1" Height="118px" Width="183px">
<Fields>
<asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True"
SortExpression="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="STD" HeaderText="STD" SortExpression="STD" />
<asp:BoundField DataField="Address" HeaderText="Address"
SortExpression="Address" />
<asp:BoundField DataField="Phone No." HeaderText="Phone No."
SortExpression="Phone No." />
</Fields>
</asp:DetailsView>
</div>
<asp:FormView ID="FormView1" runat="server" DataKeyNames="Id"
DataSourceID="SqlDataSource2" Height="116px" Width="233px">
<EditItemTemplate>
Id:
<asp:Label ID="IdLabel1" runat="server" Text='<%# Eval("Id") %>' />
<br />
Name:
<asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
<br /> STD:
<asp:TextBox ID="STDTextBox" runat="server" Text='<%# Bind("STD") %>' />
<br />
Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
<br />
Phone No.:
<asp:TextBox ID="Phone_No_TextBox" runat="server" Text='<%# Bind("[Phone
No.]") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate> <InsertItemTemplate>
Id:
<asp:TextBox ID="IdTextBox" runat="server" Text='<%# Bind("Id") %>' />
<br /> Name:
<asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
<br /> STD:
<asp:TextBox ID="STDTextBox" runat="server" Text='<%# Bind("STD") %>' />
<br /> Address:
<asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
<br /> Phone No.:
<asp:TextBox ID="Phone_No_TextBox" runat="server" Text='<%# Bind("[Phone No.]") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
Id:
<asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
<br /> Name:
<asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
<br /> STD:
<asp:Label ID="STDLabel" runat="server" Text='<%# Bind("STD") %>' />
<br /> Address:
<asp:Label ID="AddressLabel" runat="server" Text='<%# Bind("Address") %>' />
<br />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:connStr %>" SelectCommand="SELECT * FROM
[Student]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$
ConnectionStrings:connStr %>" SelectCommand="SELECT * FROM
[Student]"></asp:SqlDataSource>
</form>
</body>
</html>
0 Comments