Hello,
I am trying to extend DataPager control to have predefined template
fields.
Public Class WebPager
Inherits DataPager
Protected Overloads Overrides Sub OnInit(ByVal e As
EventArgs)
MyBase.OnInit(e)
Dim field As New TemplatePagerField
field.PagerTemplate = New WebPagerTemplate()
Me.Fields.Add(field)
Me.Fields.Add(field)
End Sub
End Class
And the template field is defined as follows:
Public Class WebPagerTemplate
Implements ITemplate
Public Sub InstantiateIn(ByVal container As Control) Implements
ITemplate.InstantiateIn
...
End Sub
End Class
The problem is that I need to run some code inside the
TemplatePagerField's Command event.
So I need to override it right?
How can I do this?
And should I do it in class WebPager or in WebPagerTemplate.
In my opinion I should override the OnCommand event in
WebPagerTemplate but I don't know how to do it.
Could someone, please, help me out?
Thanks,
Miguel
shapper - 17 Mar 2008 20:49 GMT
> Hello,
>
[quoted text clipped - 44 lines]
>
> Miguel
Hello,
I found the following:
"The OnPagerCommand method also enables derived classes to handle the
event without attaching a delegate. This is the preferred technique
for handling the event in a derived class.
Notes to Inheritors:
When you override OnPagerCommand in a derived class, call the base
class's OnPagerCommand method so that registered delegates receive the
event."
In this article:
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.templatepager
field.onpagercommand.aspx
However, I am not sure how to do this.
Could someone, please, help me out?
I don't know to to start.
Thanks,
Miguel