| |

VerySource

 Forgot password?
 Register
Search
View: 968|Reply: 9

How to traverse the data on the datagrid foreach name and insert the traversed data into the data table

[Copy link]

2

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-27 21:00:01
| Show all posts |Read mode
How to traverse the data on the datagrid foreach name and insert the traversed data into the data table
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-22 00:30:01
| Show all posts
The data source when you bind can use
Reply

Use magic Report

0

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-2-22 10:00:02
| Show all posts
No need to foreach
Direct datatable = datagrid.datasource
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-22 11:00:02
| Show all posts
If you want the original data sheet.

Just take the DataSource directly


DataTable dt = ((DataView) this.DataGrid1) .Table;
Reply

Use magic Report

0

Threads

64

Posts

45.00

Credits

Newbie

Rank: 1

Credits
45.00

 China

Post time: 2020-2-22 17:00:02
| Show all posts
You can also use for
for (int i = 0; i <mydatagrid.Items.Count; i ++)
{
    string data = mydatagrid.Items [i] .Cells [0] .Text;
    string col = mydatagrid.Items [i] .FindControl ("Yourcontrol");
}
Reply

Use magic Report

0

Threads

34

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-2-22 19:15:01
| Show all posts
attention……
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-4 15:15:01
| Show all posts
Didn't understand! Pay attention
Reply

Use magic Report

1

Threads

18

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-3-4 22:45:01
| Show all posts
Use the DataSource property directly
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-21 22:45:01
| Show all posts
for (int i = 0; i <mydatagrid.Items.Count; i++)
{
    string data = mydatagrid.Items[i].Cells[0].Text;
    string col = mydatagrid.Items[i].FindControl("Yourcontrol");
}
Reply

Use magic Report

0

Threads

23

Posts

20.00

Credits

Newbie

Rank: 1

Credits
20.00

 China

Post time: 2020-8-21 23:00:01
| Show all posts
You can use the data source when you bind
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list