Create a web application to demonstrate various uses and properties of SqlDataSource

 Source Code:- 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="8a.aspx.cs" 

Inherits="_6A._8a" %> 

<!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="82px" Width="235px"> 

                <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:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ 

ConnectionStrings:connStr %>" SelectCommand="SELECT * FROM 

[Student]"></asp:SqlDataSource> 

    </form> 

</body> 

</html>  

Output:- 



Post a Comment

0 Comments