Pause ViewCellFormatting while reloading

1 Answer 97 Views
GridView
Jure
Top achievements
Rank 2
Iron
Iron
Iron
Jure asked on 08 Dec 2022, 10:02 AM

Hey, how can I skip the ViewCellFormatting event while the grid is getting new data?

Maybe there's some property I can check before continuing formatting? I have two interdependent grids and would like to "pause" this event whenever any of them is reloading...

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Dec 2022, 10:26 AM

Hi, Jure,

The easiest approach is to unsubscribe from the ViewCellFormatting event before the action for reloading and subscribe back to the event after the action is completed.

Please give it a try and see how it works on your end. I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Jure
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Dec 2022, 10:28 AM

OK, I was hoping there's some more elegant approach. I guess not. Thanks!
Jure
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Dec 2022, 10:30 AM

I know this is not Telerik specific but is it possible to remove the handler without specifying the concrete event? What I mean something like (without AddressOf): 


RemoveHandler grid.ViewCellFormatting '???

Jure
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Dec 2022, 10:32 AM

I complicate because the loading is done in each of the child (grid) forms but the formatting is done in the parent...
Jure
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Dec 2022, 10:38 AM

Nevermind, I've got it working. Now I just need the event that triggers the ViewCellFormatting event - it works when I start scrolling...
Jure
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Dec 2022, 10:40 AM

grid.Update, grid.Refresh and grid.Invalidate don't cut it:
Private Sub form_BeforeLoad(grid As RadGridView) Handles form1.BeforeLoad, form2.BeforeLoad
        RemoveHandler grid.ViewCellFormatting, AddressOf grid_ViewCellFormatting
    End Sub

    Private Sub form_AfterLoad(grid As RadGridView) Handles form1.AfterLoad, form2.AfterLoad
        AddHandler grid.ViewCellFormatting, AddressOf grid_ViewCellFormatting
        'trigger the ViewCellFormatting event ??
        grid.Invalidate()
    End Sub

Dess | Tech Support Engineer, Principal
Telerik team
commented on 08 Dec 2022, 11:32 AM

Hello, Jure,  

To force firing the ViewCellFormatting event, you can just refresh the master template by calling the MasterTemplate.Refresh method. 
Jure
Top achievements
Rank 2
Iron
Iron
Iron
commented on 08 Dec 2022, 11:34 AM

Yes Dess, this works! Thanks.
Tags
GridView
Asked by
Jure
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or