R
Roshawn
Hi,
I have created a web user control that acts as a numeric pager on my page.
It consists of a repeater controls and an HtmlAnchor control. Of course the
HtmlAnchor is placed in the repeater's ItemTemplate template. Just a note
that the HtmlAnchor control is not set as a server control.
In the web user control I've created an event named PagerClick. What I'm
trying to do is pass the HtmlAnchor's InnerText to the page that contains
the web user control so further processing can be done. Here's my code:
Public Class SelectedAnchorEventArgs
Inherits EventArgs
Public Text As String
End Class
Public MustInherit Class NumericPager
Inherits System.Web.UI.UserControl
Protected WithEvents Repeater2 As System.Web.UI.WebControls.Repeater
Event PagerClick(ByVal sender As Object, ByVal e As
SelectedAnchorEventArgs)
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Public Function PagerNumbers() As ArrayList
'code implementation omitted, though it works great
End Function
Public Sub BindPager(ByVal arr As ArrayList)
With Me.Repeater2
.DataSource = arr
.DataBind()
End With
End Sub
Public Sub Pager_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim eventinfo As New SelectedAnchorEventArgs()
eventinfo.Text = CType(sender, HtmlAnchor).InnerText
RaiseEvent PagerClick(Me, eventinfo)
End Sub
End Class
Here is my code on the host page that uses the PagerClick event of the web
user control:
Private Sub NPager_Click(ByVal sender As Object, ByVal e As
SelectedAnchorEventArgs) Handles
NPager.PagerClick
Me.ViewState("page") = e.Text
Call GetKeywordData()
End Sub
I don't know why, but the procedure on the host page doesn't work. I've
tried modifying the attributes of the HtmlAnchor. I'm not sure if I'm to
override its OnServerClick method to get things to work. I've tried
everything else, but no success.
So I've come to feet of the great ASP.NET programmers out there. Can anyone
point me in the right direction? I've been toying with this all weekend
long. Any help will be greatly appreciated.
Thanks,
Roshawn
Sorry for cross-posting :-(
I have created a web user control that acts as a numeric pager on my page.
It consists of a repeater controls and an HtmlAnchor control. Of course the
HtmlAnchor is placed in the repeater's ItemTemplate template. Just a note
that the HtmlAnchor control is not set as a server control.
In the web user control I've created an event named PagerClick. What I'm
trying to do is pass the HtmlAnchor's InnerText to the page that contains
the web user control so further processing can be done. Here's my code:
Public Class SelectedAnchorEventArgs
Inherits EventArgs
Public Text As String
End Class
Public MustInherit Class NumericPager
Inherits System.Web.UI.UserControl
Protected WithEvents Repeater2 As System.Web.UI.WebControls.Repeater
Event PagerClick(ByVal sender As Object, ByVal e As
SelectedAnchorEventArgs)
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Public Function PagerNumbers() As ArrayList
'code implementation omitted, though it works great
End Function
Public Sub BindPager(ByVal arr As ArrayList)
With Me.Repeater2
.DataSource = arr
.DataBind()
End With
End Sub
Public Sub Pager_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim eventinfo As New SelectedAnchorEventArgs()
eventinfo.Text = CType(sender, HtmlAnchor).InnerText
RaiseEvent PagerClick(Me, eventinfo)
End Sub
End Class
Here is my code on the host page that uses the PagerClick event of the web
user control:
Private Sub NPager_Click(ByVal sender As Object, ByVal e As
SelectedAnchorEventArgs) Handles
NPager.PagerClick
Me.ViewState("page") = e.Text
Call GetKeywordData()
End Sub
I don't know why, but the procedure on the host page doesn't work. I've
tried modifying the attributes of the HtmlAnchor. I'm not sure if I'm to
override its OnServerClick method to get things to work. I've tried
everything else, but no success.
So I've come to feet of the great ASP.NET programmers out there. Can anyone
point me in the right direction? I've been toying with this all weekend
long. Any help will be greatly appreciated.
Thanks,
Roshawn
Sorry for cross-posting :-(