Category >
ASP.NET
|| Published on :
Tuesday, June 30, 2015 || Views:
6453
||
ASP.NET DetailView with example in ASP.NET using C# ASP.NET DetailViewm ASP.NET DetailView control
Introduction:-
In this Tutorial we are going to learn How to implement ASP.NET DetailView with example in ASP.NET using C#
Description:-
In previous articles, I have explained you How to find datetime difference in milli seconds using asp.net using c# example , How to do Cross-Page Posting in Asp.Net and C# , How to use UpdateProgress control in Asp.Net and C Sharp , How to play YouTube videos in asp.net Web Application, How to develop a Simple Chat Application in C# Using SignalR and now we are going to learn how to add scrollbar in asp.net checkboxlist.
So lets starts the coding.:-)
First of all create a Database table with following schema
CREATE TABLE [dbo].[Person](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) NULL,
[Address] [varchar](500) NULL,
CONSTRAINT [PK_Person] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[Person] ON
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (1, N'Ram', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (2, N'Shyam', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (3, N'Rahul', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (4, N'Raj', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (5, N'Shahrukh', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (6, N'Amir', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (7, N'Raju', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (8, N'Rohit', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (9, N'Raghu', N'23, Delhi, India')
INSERT [dbo].[Person] ([Id], [Name], [Address]) VALUES (10, N'Samir', N'23, Delhi, India')
SET IDENTITY_INSERT [dbo].[Person] OFF
Step 1: First, we start by creating an Empty asp.net web site in Visual Studio .NET 2010.
Step 2: Create an ASPX Page for Right Click on Solution Explorer > Add Items > Web > Webform and save it as "Default.aspx".When we first open our Default.aspx page
Step 3: Now write the below codes in asp.net design mode.
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="false" AllowPaging="true"
DataSourceID="SqlDataSource1">
<Fields>
<asp:BoundField DataField="CustomerId" HeaderText="Customer Id" HeaderStyle-CssClass="header" />
<asp:BoundField DataField="Name" HeaderText="Name" HeaderStyle-CssClass="header" />
<asp:BoundField DataField="Country" HeaderText="Country" HeaderStyle-CssClass="header" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>"
SelectCommand="SELECT CustomerId, Name, Country FROM Customers"></asp:SqlDataSource>
So this we have learned learn How to implement ASP.NET DetailView with example in ASP.NET using C#.... Happy Coding!!!!