简体   繁体   中英

How can i fill my list from rad grid view?

I have a telerik grid view and i want to fill my list with one of the columns, but when i check my list it's empty.

Here is my code

foreach (int item in _MyAmount)
{
    _MyAmount.Add(item);
}

I know it is not related to my grid view. Can you teach me how to do that?

So, on form we have some RadGridView and Button. To make value type in Column as int you can use DataType property.

List<int> someList = new List<int>();

private void button1_Click(object sender, EventArgs e)
{
    foreach (var row in radGridView1.Rows)
        // 0 - first column
        someList.Add((int)row.Cells[0].Value);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM