I'm having a simliar problem to this. I've tried the solution in this, but it is not working either.
I have a LinkButton that is dynamically added through a seperate class file. The LinkButton itself is it's own class as well.
Here's what I have. These and some other controls are being inputted onto the page during the Render event which is overriden in the seperate class file.
Any Suggestions?????!!!
Private Sub AddAlphabeticPagingRow(ByVal output As System.Web.UI.HtmlTextWriter)
Dim pnlDiv As New Panel
Dim rptData As New Repeater
pnlDiv.ID = "divAlphaPaging"
pnlDiv.RenderBeginTag(output)
Dim i As Integer
Dim lc As LiteralControl
Dim l As BAMAlphaPagingLink
For i = 65 To 65 + 25
l = New BAMAlphaPagingLink
lc = New LiteralControl
lc.Text = " | "
l.ID = "lnkAlpha" & Chr(i)
l.Text = Chr(i)
l.EnableViewState = True
l.Attributes.Add("href", "Javascript:" + Page.GetPostBackEventReference(l, Chr(i)))
' l.Attributes.Add("onClick", "Page.GetPostBackEventReference(l, Chr(i)))
l.RenderControl(output)
lc.RenderControl(output)
Next
pnlDiv.RenderEndTag(output)
End Sub
'''''Heres the class for the LinkButton'''
Public Class BAMAlphaPagingLink
Inherits System.Web.UI.WebControls.LinkButton
'Implements System.Web.UI.IPostBackEventHandler
Public Sub New()
MyBase.New()
End Sub
#Region " Propterties "
#End Region
Public Event PagingLinkClicked As EventHandler
Public Sub RaisePostBackEvent()
'Implements IPostBackEventHandler.raisepostbackevent
OnPagingLinkClicked(New EventArgs)
End Sub
Protected Overridable Sub OnPagingLinkClicked(ByVal e As EventArgs)
If (PagingLinkClickedEvent Is Nothing) Then
RaiseEvent PagingLinkClicked(Me, e)
End If
End Sub
End Class