privateDataTableCreateDataTable() { // Define the new datatable DataTable dt =newDataTable();
// Define 3 columns DataColumn dc; dc =newDataColumn("LastName"); dt.Columns.Add(dc); dc =newDataColumn("FirstName"); dt.Columns.Add(dc); dc =newDataColumn("Street"); dt.Columns.Add(dc);
vickyasp.net
Member
570 Points
425 Posts
i want to add Cell value in gridview c#
Dec 28, 2012 08:27 AM|LINK
i want to add Cell Values based on increament value for loophere this 1,2,3 automatically add value in gridview at rowsany one help meVignesh
shree_ars
Participant
1395 Points
776 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 08:42 AM|LINK
do u need to add those "1,2,3" and display it where? and when it should happen for you?
this can be carried out on any grigview event and loop through all values and add it.
vickyasp.net
Member
570 Points
425 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 08:45 AM|LINK
1,2,3 its values getting from loop, i want to add gridview row in cells it depends upon increment values.
Vignesh
shree_ars
Participant
1395 Points
776 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 08:50 AM|LINK
for(i=0 for gridview rows)
{
for (j =0 for gridview column )
{
int addvalues = get gridview cell[i][j];
}
}
vickyasp.net
Member
570 Points
425 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 09:01 AM|LINK
Sorry i want to add Each row of the Column values
Vignesh
me_ritz
Star
9337 Points
1447 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 09:11 AM|LINK
You can add an additional column to DataTable with autoincremented value.
private DataTable CreateDataTable() { // Define the new datatable DataTable dt = new DataTable(); // Define 3 columns DataColumn dc; dc = new DataColumn("LastName"); dt.Columns.Add(dc); dc = new DataColumn("FirstName"); dt.Columns.Add(dc); dc = new DataColumn("Street"); dt.Columns.Add(dc); dc = new DataColumn("AutoID"); dc.AutoIncrement = true; dc.AutoIncrementSeed = 1; dc.AutoIncrementStep = 1; dt.Columns.Add(dc); // Define 2 rows dt.Rows.Add("Baggins", "Frodo", "Bagshot Row"); dt.Rows.Add("Kurata", "Deborah", "Main Street"); return dt; }vickyasp.net
Member
570 Points
425 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 09:17 AM|LINK
dt.Rows.Add("Baggins", "Frodo", "Bagshot Row","1","2","3");Vignesh
ashkc
Participant
960 Points
200 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 09:27 AM|LINK
add <container.dataitemindex+1> for the GridView
vickyasp.net
Member
570 Points
425 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 10:06 AM|LINK
Hi
me_ritz
how to add values
Vignesh
me_ritz
Star
9337 Points
1447 Posts
Re: i want to add Cell value in gridview c#
Dec 28, 2012 10:39 AM|LINK
Values are added automatically ....starting from 1 with interval 1...