I have a radgridview in my form where i want to enter data, but i dont want to execute the submit changes after adding a row
i.e. i want to add say 5 rows and then click a save button and save all 5 rows to the database.
I have been trying hard to get this work but no luck.
Any help will be greatly appreciated.
5 Answers, 1 is accepted
If you are using WCF Ria services and DomainDataSource - this should be available out of the box. You can insert as many rows as needed and they will be submitted to the database once you call the SubmitChanges method of the domain datasource.
If not, you can set the ActionOnLostFocus property of RadGridView to None.
Best wishes,
Veselin Vasilev
the Telerik team
and my item click function goes like this
private void radcontextmenu_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
RadContextMenu menu = (RadContextMenu)sender;
RadMenuItem clickedItem = e.OriginalSource as RadMenuItem;
if (clickedItem != null)
{
string header = Convert.ToString(clickedItem.Header);
switch (header)
{
case "Add":
this.GridViewB.Items.Add(this.GridViewB.Items.Count + 1);
break;
case "Delete":
GridViewRow row = menu.GetClickedElement<GridViewRow>();
this.GridViewB.Items.Remove(this.GridViewB.SelectedItem);
break;
}
}
}
whenver i click add, enter data and move to other cell the value doesnt remain in the cell(the cell will be blank).Can you post more info how the grid is bound in your case? What kind of collection and objects you are using?
Kind regards,Vlad
the Telerik team
thanks for your reply
ok i made some change in the following line
this.GridViewB.Items.Add(this.GridViewB.Items.Count + 1);
as
this.GridViewB.Items.Add(new BILL());
now it is fine. the items stay in the grid.
I am using two way binding for the datacolumn items in the radgridview.
And onrowedit ended
for insert case
i am moving the contents of each row into the list of the BILL object.
and on save button click i am using foreach loop to insert all the objects in the list.
this works fine for insert but this doesnt work for edit and delete.
Any suggestions