Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 737
  • Last Modified:

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.
0
Amandeep Singh Bhullar
Asked:
Amandeep Singh Bhullar
  • 3
  • 2
  • 2
  • +1
2 Solutions
 
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
 
Amandeep Singh BhullarAuthor Commented:
I need to insert new row into the Grid
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
SiyamalaCommented:
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.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now