Access AddNewRow in CodeBehind (C#)

9 posts, 0 answers
  1. Ramesh
    Ramesh avatar
    19 posts
    Member since:
    Mar 2013

    Posted 22 Apr 2013 Link to this post

    Hi,

    I am using RadGridView in my application, in that i want to access the AddNewRow in code behind and want to apply cell values from there. Please help me by providing a solution.

    Thanks,
    Ramesh
    velusamyr@hcl.com
  2. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 22 Apr 2013 Link to this post

    Hi Ramesh,

    In order to achieve your goal, you can handle the AddingNewDataItem event. You can check this help article for a reference.

    I hope this helps.

    Greetings,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Ramesh
    Ramesh avatar
    19 posts
    Member since:
    Mar 2013

    Posted 22 Apr 2013 Link to this post

    Hi Yoan,

    Thanks alot ofr your response and the solution. This is helpful for us.
    Also please let me know how to move focus of a cell from another cell.

    EX:

    Current cell focus is on : 2nd row, 2nd column.
    Now i want to move the focus to 2nd row, 3rd column.

    Please help me.

    Ramesh,
    velusamyr@hcl.com
  5. Ramesh
    Ramesh avatar
    19 posts
    Member since:
    Mar 2013

    Posted 23 Apr 2013 Link to this post

    Hello Support,

    The solution provided in your previous update is not helpful.
    We cannot access the "AddNewRow" that is in the Current view.Please provide a solution for us.

    Requirement:

    We need to Apply a value for the AddNewRow's 1st cell from code behind(Barcode scanner value).

    Please help us.

    Ramesh.
    velusamyr@hcl.com
  6. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 24 Apr 2013 Link to this post

    Hi Ramesh,

    Could you clarify a bit ? Do you want to manipulate the value after the new row is added ?

    Kind regards,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. Ramesh
    Ramesh avatar
    19 posts
    Member since:
    Mar 2013

    Posted 26 Apr 2013 Link to this post

    Hi Yoan,

    Please find my requirements as below.

    I have AddNewRow ("Default support provided by telerik") in my grid at the top of all rows by using "ShowInsertRow="True". Now i have to access that row in a button click and wanted to set values for that row in button click event.

    Please help me , this is very important for our project and this causing delay in our productivity.

    Regards,
    Ramesh
    velusamyr@hcl.com
  8. Ramesh
    Ramesh avatar
    19 posts
    Member since:
    Mar 2013

    Posted 26 Apr 2013 Link to this post

    Hi Yoan,

    Please find my requirements as below.

    I have AddNewRow ("Default support provided by telerik") in my grid at the top of all rows by using "ShowInsertRow="True". Now i have to access that row in a button click and wanted to set values for that row in button click event.

    Please help me , this is very important for our project and this causing delay in our productivity.

    Regards,
    Ramesh
    velusamyr@hcl.com
  9. Ramesh
    Ramesh avatar
    19 posts
    Member since:
    Mar 2013

    Posted 26 Apr 2013 Link to this post

    Hi Yoan,

    Please find my requirements as below.

    I have AddNewRow ("Default support provided by telerik") in my grid at the top of all rows by using "ShowInsertRow="True". Now i have to access that row in a button click and wanted to set values for that row in button click event.

    Please help me , this is very important for our project and this causing delay in our productivity.

    Regards,
    Ramesh
    velusamyr@hcl.com
  10. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 30 Apr 2013 Link to this post

    Hi Ramesh,

    The new item is automatically added at the end of the source collection. You could access the it directly.
    For example lets say the business object is of type Club and it has properties Name and StadiumCapacity:

    private void Button1_Click(object sender, RoutedEventArgs e)
            {
                var itemsCount = this.clubsGrid.Items.Count;
                Club club = this.clubsGrid.Items[itemsCount-1] as Club;
                club.Name = "NewName";
                club.StadiumCapacity = 12;   
            }



    Regards,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready