In this article i show you how to use gridview with templatefields in asp.net
step1:-Create table
CREATE TABLE tblEmp
(
Id int primary key identity,
FirstName varchar(50),
LastName varchar(50),
Designation varchar(50),
Salary int,
City varchar(50),
)
Step2:-Insert some data in table
INSERT INTO tblEmp VALUES('SIVA','Garika','UiDeveloper',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Narayana','Garika','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Kiran','Thota','Developer',35000,'Hydarabad')
INSERT INTO tblEmp VALUES('Madhu','Thota','Developer',19000,'Hydarabad')
INSERT INTO tblEmp VALUES('Manasa','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Malavika','Dongari','Developer',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Mounika','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Anji','Dongari','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Aravind','Choodi','Developer',32000,'Hydarabad')
INSERT INTO tblEmp VALUES('Avinash','Choodi','Developer',26000,'Hydarabad')
step1:-Create table
CREATE TABLE tblEmp
(
Id int primary key identity,
FirstName varchar(50),
LastName varchar(50),
Designation varchar(50),
Salary int,
City varchar(50),
)
Step2:-Insert some data in table
INSERT INTO tblEmp VALUES('SIVA','Garika','UiDeveloper',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Narayana','Garika','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Kiran','Thota','Developer',35000,'Hydarabad')
INSERT INTO tblEmp VALUES('Madhu','Thota','Developer',19000,'Hydarabad')
INSERT INTO tblEmp VALUES('Manasa','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Malavika','Dongari','Developer',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Mounika','Javisetty','Testar',15000,'Hydarabad')
INSERT INTO tblEmp VALUES('Anji','Dongari','Developer',25000,'Hydarabad')
INSERT INTO tblEmp VALUES('Aravind','Choodi','Developer',32000,'Hydarabad')
INSERT INTO tblEmp VALUES('Avinash','Choodi','Developer',26000,'Hydarabad')