This is a migrated thread and some comments may be shown as answers.

iterate through rows after "click here to add a new row"

3 Answers 29 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chang
Top achievements
Rank 1
Chang asked on 13 Oct 2015, 03:59 AM
I want to iterate through the rows created after I added them in the "click here to add a new row" and shows up at the bottom. How do I iterate through these new rows?

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 13 Oct 2015, 09:12 AM
Hello Chang,

Thank you for writing.

The following article shows how you can iterate the grid rows: Iterating Rows.

Let me know if you have additional questions.

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Chang
Top achievements
Rank 1
answered on 13 Oct 2015, 09:26 AM
Hi, I understand that I can use an event right after the row in changed, but I was instructed that I will have to add them as a batch manually using a button. In this case since the add row data is added to the existing gridview rows, how can I tell the newly added row data apart from the data that already exists in the gridview? I would like to iterate through the rows and only select the rows that I typed in to add to the database, but not the existing data, is there a flag or mark I can use? Thanks for the reply!
0
Accepted
Dimitar
Telerik team
answered on 14 Oct 2015, 11:39 AM
Hello Chang,

Thank you for writing back.

You can use the UserAddedRow to set the tag:
void radGridView1_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e)
{
    e.Row.Tag = "new";
}
private void radButton1_Click(object sender, EventArgs e)
{
    foreach (GridViewRowInfo rowInfo in radGridView1.Rows)
    {
        if (rowInfo.Tag != null && rowInfo.Tag == "new")
        {
            Console.WriteLine(rowInfo.Tag);
        }
    }
}

I hope this will be useful. 

Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Chang
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Chang
Top achievements
Rank 1
Share this question
or