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

Access AddNewRow in CodeBehind (C#)

8 Answers 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ramesh
Top achievements
Rank 1
Ramesh asked on 22 Apr 2013, 06:19 AM
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

8 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 22 Apr 2013, 02:44 PM
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.

0
Ramesh
Top achievements
Rank 1
answered on 23 Apr 2013, 03:16 AM
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
0
Ramesh
Top achievements
Rank 1
answered on 23 Apr 2013, 07:52 AM
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
0
Yoan
Telerik team
answered on 24 Apr 2013, 07:58 AM
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.

0
Ramesh
Top achievements
Rank 1
answered on 26 Apr 2013, 11:24 AM
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
0
Ramesh
Top achievements
Rank 1
answered on 26 Apr 2013, 11:25 AM
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
0
Ramesh
Top achievements
Rank 1
answered on 26 Apr 2013, 11:25 AM
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
0
Yoan
Telerik team
answered on 30 Apr 2013, 03:38 PM
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.

Tags
GridView
Asked by
Ramesh
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Ramesh
Top achievements
Rank 1
Share this question
or