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

Adding new with rowdetails raddataform

2 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Randy Hompesch
Top achievements
Rank 1
Randy Hompesch asked on 30 Nov 2016, 12:15 PM

Hi,

I have a gridview that I have marked as readonly because I *only* want the user to be able to edit/add data via my rowdetails editor. According to the doc if I have the gridview marked as readonly they can't add a new row. I'm stuck. I need a way to add a row and have the user enter the new info via the rowdetails datattemplated editor. Any ideas?

 

Thanks ... Ed

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 01 Dec 2016, 04:01 PM
Hello Ed,

Although you cannot add new records through RadGridView's UI or with the BeginInsert method when the grid is read-only, you can use its Items collection's AddNewItem method to add an item and select it if needed.

private void Button1_Click(object sender, RoutedEventArgs e)
{
    var item = new Club() { Name = "Asd" };
    this.clubsGrid.Items.AddNewItem(item);
    this.clubsGrid.SelectedItem = item;
}

Please let me know whether such an approach would work for you.

Regards,
Dilyan Traykov
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Randy Hompesch
Top achievements
Rank 1
answered on 01 Dec 2016, 08:25 PM

That'll work!

Thanks.

 

Tags
GridView
Asked by
Randy Hompesch
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Randy Hompesch
Top achievements
Rank 1
Share this question
or