How to use inserttemplate in gridview.

How to add new row in the gridview on the click of button that are also add in gridview.
LVL 19
Amandeep Singh BhullarAsked:
Who is Participating?
 
SiyamalaCommented:
0
 
jagssiduralaCommented:
DataTable dt = new DataTable();

get data and assign dt from database Then write below code

Gv.DataSource = dt;
Gv.DataBind();

I assumed dt is having two columns EmployeeId,EmployeeName.

In button click you need to write below code

dt.Rows.Add(0,"Jagssidurala");
Gv.DataSource = dt;
Gv.DataBind();
0
 
SiyamalaCommented:
Hi ,
Try with sample in this url which would help you
http://www.dotnetspark.com/kb/643-how-to-editupdatedelete-gridview.aspx
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
Amandeep Singh BhullarAuthor Commented:
I need to insert new row into the Grid
0
 
jagssiduralaCommented:
I think the code which i have written in first comment is exactly matches your need.
0
 
Amandeep Singh BhullarAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.