I have a class that inherits from the linkbutton class and I dynamically add instances 
of this class to my webpage.  When this loading is done in the page_load event 
everything works fine.  When this is done anywhere else it loads ok but the custom 
functionality does not work right, it acts like a regular linkbutton control.  I can't 
figure out what im missing.

ken



function that does the adding

        Dim row As HtmlTableRow = New HtmlTableRow()
        Dim cell As HtmlTableCell = New HtmlTableCell()

        ken = New HtmlTable()
        link = New HuyLinkButton()
        link.Height = System.Web.UI.WebControls.Unit.Pixel(20)
        link.Width = System.Web.UI.WebControls.Unit.Pixel(20)
        link.Text = "hello huy"
        link.NavigateURL = "http://www.google.com";
        AddHandler link.Click, AddressOf Link_click

        cell.Controls.Add(link)
        row.Controls.Add(cell)
        ken.Controls.Add(row)
        Page.FindControl("Form1").Controls.Add(ken)


my class

Public Class HuyLinkButton
    Inherits System.Web.UI.WebControls.LinkButton
    Private Link As String

    Public Property NavigateURL()
        Get
            Return Link
        End Get
        Set(ByVal Value)
            Link = Value.ToString
        End Set
    End Property

End Class

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to