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

We've got a RowLoaded event! Could we get a RowLoading event?

4 Answers 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
John Thompson
Top achievements
Rank 2
John Thompson asked on 25 Jun 2010, 07:00 PM
I have a custom control that I need to bypass UI event raising because of the interaction of a tree state IsComplete and CompletionDate property.

If I had a RowLoading event that occurs before binding I could disable the firing of events during be row creation process and restore the event firing in the RowLoaded event.

Of course, other suggestions are always welcome!  

4 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 29 Jun 2010, 04:23 PM
Hi John Thompson,

Could you please show us some code that will help us better understand your scenario ans requirements.


Sincerely yours,
Milan
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
John Thompson
Top achievements
Rank 2
answered on 29 Jun 2010, 04:41 PM
How about something like this:

        private void gridMatter_RowLoading(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e) 
        { 
            CheckListItem item = e.DataElement as CheckListItem; 
 
            if (item == null) 
            { 
                return; 
            } 
 
            item.CanFireEvents = false
        } 
 
        private void gridMatter_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e) 
        { 
            CheckListItem item = e.DataElement as CheckListItem; 
 
            if (item == null) 
            { 
                return; 
            } 
 
            item.CanFireEvents = true
            }        

Since the CheckListItem object has properties that are bound to the UI and also interact with each other this would allow me to detect the initializing of the UI elements and avoid firing events that have side effects.

Does this help?
0
Milan
Telerik team
answered on 30 Jun 2010, 03:57 PM

Hi John Thompson,

Since the event handling is controlled by the data you can use our DataLoading event:

void clubsGrid_DataLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
{
    foreach (CheckListItem item in (e.ItemsSource as Ilist<CheckListItem>))
    {
        item.CanFireEvents = false
    }
}
  
void clubsGrid_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
{
    // enable fireing
}


Regards,
Milan
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
John Thompson
Top achievements
Rank 2
answered on 30 Jun 2010, 04:03 PM
I thought so, too.  However the Dataloading and DataLoaded are all done before the binding begins.since the data load mode is set to asynchronous and the scroll mode is deffered.

There is quite a bit of data in the grid but I will change the DataLoadMode and the ScrollMode to see how this affects performance.
Tags
GridView
Asked by
John Thompson
Top achievements
Rank 2
Answers by
Milan
Telerik team
John Thompson
Top achievements
Rank 2
Share this question
or