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

RowEditEnded error

6 Answers 85 Views
GridView
This is a migrated thread and some comments may be shown as answers.
shane
Top achievements
Rank 1
shane asked on 12 May 2010, 05:38 AM
if gridview is empty , no problem. if gridview has items , when I AddNewRow, BeginInsert()->AddingNewDataItem()->RowEditEnded(),the new record add to list directly,not wait for Edit it when the first time insert record

6 Answers, 1 is accepted

Sort by
0
shane
Top achievements
Rank 1
answered on 13 May 2010, 03:09 AM
Need help,I think this problem is a Bug.
0
shane
Top achievements
Rank 1
answered on 13 May 2010, 06:31 AM
where is admin???
0
shane
Top achievements
Rank 1
answered on 13 May 2010, 08:50 AM
HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
0
Nedyalko Nikolov
Telerik team
answered on 14 May 2010, 07:46 AM
Hello shane,

We'll need some more information in order to simulate the issue. Could you please send us code inside AddingNewDataItem() and RowEditEnded() event handlers. Also we need some more details about data source and business object to which RadGridView is bound. A sample project that demonstrates the issue will be great.

Sincerely yours,
Nedyalko Nikolov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
shane
Top achievements
Rank 1
answered on 14 May 2010, 09:16 AM

public class PersonRelation:StandardGridClass
    {
        Guid personId;
        public PersonRelation(Guid PersonId)
        {
            personId = PersonId;
        }

        public override void LoadData()
        {
            sf.rgv.IsBusy = true;
            LoadOperation<HRM_Relation> load = domain.Load<HRM_Relation>(domain.GetHRM_RelationQuery());
            load.Completed += new EventHandler(load_Completed);
        }

        void load_Completed(object sender, EventArgs e)
        {
            var load = sender as LoadOperation<HRM_Relation>;
            sf.rgv.ItemsSource = load.Entities;
            sf.rgv.IsBusy = false;
        }

void add_Click(object sender, RoutedEventArgs e)
        {
            sf.rgv.BeginInsert();
        }      
 

        public override void Delete()
        {
            foreach (var item in sf.rgv.SelectedItems)
            {
                domain.HRM_Relations.Remove(item as HRM_Relation);
            }
            if (!domain.IsSubmitting)
            {
                domain.SubmitChanges().Completed += new EventHandler(Submit_Completed);
            }
        }

        public override void rgv_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
        {
            HRM_Relation NewObject = new HRM_Relation();
            NewObject.RelationId = Guid.NewGuid();
            NewObject.PersonId = personId;
            e.NewObject = NewObject;
        }

        public override void rgv_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
        {
            PopUpMessageBox.Show(NotifyString.Updating, false);
            if (e.EditAction == GridViewEditAction.Cancel)
            {
                PopUpMessageBox.Close(NotifyString.Updating, false);
                return;
            }
            if (e.EditOperationType == GridViewEditOperationType.Insert)
            {
                domain.HRM_Relations.Add(e.NewData as HRM_Relation);
                domain.SubmitChanges().Completed += new EventHandler(Submit_Completed);
            }
            if (e.EditOperationType == GridViewEditOperationType.Edit)
            {
                domain.SubmitChanges().Completed += new EventHandler(Submit_Completed);
            }
        }
    }

0
Accepted
Nedyalko Nikolov
Telerik team
answered on 14 May 2010, 03:41 PM
Hi shane,

Generally everything looks OK with your code. Indeed EntityCollection does not implement IList interface and RadGridView cannot add this item automatically, so you have to add it manually. But I cannot see any reason why there is a different behavior when RadGridView is empty and when there is item. Could you please send me a sample project that I can debug on my side?

Greetings,
Nedyalko Nikolov
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
shane
Top achievements
Rank 1
Answers by
shane
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or