We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridDataBoundGrid PrepareViewStyleInfo Event

Hi I am preparing a class inheriting GridDataboundGrid, because i want to have own settings for my Grid, like i want to use PrepareViewStyleInfo event, but could not override it, it asks me to put shadows but even after the code in the event is not working. Where I am missing ? Regards Rajaraman

4 Replies

AD Administrator Syncfusion Team February 5, 2003 01:40 AM

In our library, all events are fired from virtual methods. So, an event named XXXXX will always be fired in a virtual method named OnXXXXX. So, if you want to 'override an event' named XXXXX, you need to override the virtual method OnXXXXX. In your case, you would override OnPrepareViewStyleInfo and do your work there. In your override, make sure you call the base class implementation so the PrepareViewStyleInfo event will be fired for any other listeners to this event (if you want to give other listeners a chance at handling the event). Just as an aside, you could just add a handler to your derived class and listen for the event as any other class could do. But if you are deriving the class, it is recommended (by MS) to do the override instead of handling the event.


RA Rajaraman February 5, 2003 06:58 AM

Hi I understand this. I have attached a Source Code file, please go through it, the onprepare...event is not firing. Help me where i am missing. Thanks Rajaraman > In our library, all events are fired from virtual methods. So, an event named XXXXX will always be fired in a virtual method named OnXXXXX. > > So, if you want to 'override an event' named XXXXX, you need to override the virtual method OnXXXXX. In your case, you would override OnPrepareViewStyleInfo and do your work there. In your override, make sure you call the base class implementation so the PrepareViewStyleInfo event will be fired for any other listeners to this event (if you want to give other listeners a chance at handling the event). > > Just as an aside, you could just add a handler to your derived class and listen for the event as any other class could do. But if you are deriving the class, it is recommended (by MS) to do the override instead of handling the event.


AD Administrator Syncfusion Team February 5, 2003 09:31 AM

The signature of OnPrepareViewStyleInfo is wrong. In VB, you can use the ClassName and MethodName dropdowns at the top of the edit window in Visual Studio to avoid this problem. Visual Studio will put in the proper stub for you if you use these dropdowns to do your overrides. In your code, you don't have to worry about casting any sender object as the Me variable will refer to the gird in question. And the sender object is not one of the arguments.
Public Class MyGrid
    Inherits GridDataBoundGrid

    Protected Overrides Sub OnPrepareViewStyleInfo(ByVal e As GridPrepareViewStyleInfoEventArgs)

    End Sub
End Class



RA Rajaraman February 5, 2003 10:53 AM

Thanks Clay Regards Rajaraman

Loader.
Live Chat Icon For mobile
Up arrow icon