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

4 posts, 1 answers
  1. Chang
    Chang avatar
    7 posts
    Member since:
    Sep 2015

    Posted 12 Oct 2015 Link to this post

    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?
  2. Dimitar
    Admin
    Dimitar avatar
    1414 posts

    Posted 13 Oct 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Chang
    Chang avatar
    7 posts
    Member since:
    Sep 2015

    Posted 13 Oct 2015 in reply to Dimitar Link to this post

    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!
  5. Answer
    Dimitar
    Admin
    Dimitar avatar
    1414 posts

    Posted 14 Oct 2015 Link to this post

    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
Back to Top