i have a page which dynanically create a link when it load, after i click on the link it should loop in the database fetch all the record and display another set of link , then when i click on these link it should give me all information about this particular record it like this one
my problem when the page load it create the first link which is associate with an event handler it fire the first event handler (Getname) but it not firing the second event handler (GetnameDetails)

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        If ViewState.Item("nameload") IsNot Nothing Then
            If ViewState.Item("nameload").ToString = "True" Then
                Getname(Me, New EventArgs)
            ElseIf ViewState.Item("Getnameload").ToString = "True" Then
                GetnameDetails(Me, New EventArgs)
            End If
        End If

page load and name link create

Private Sub CreateNamesButton()
        Dim btnName As New LinkButton
        btnName .Text = "Name"
        AddHandler btnName .Click, AddressOf Getname
        ViewState.Item("nameload") = False.ToString
    End Sub

it fire nameload event handler

Private Sub Getname(ByVal sender As Object, ByVal e As EventArgs)
        ' get products list here
        ' and set handlers for each link

        Dim testDb As New customer
        Dim arr As ArrayList = testDb.DbLoop()
        Dim ObjCustList As CustomerBo
        Dim CustInt As Integer
        Dim str As String

        Dim link As LinkButton

        For Each ObjCustList In arr
            CustInt = ObjCustList.Cus_Id
            link = New LinkButton
            Panel1.Controls.Add(New LiteralControl("<br />"))
            link.ID = CustInt
            link.Text = ObjCustList.FirstName
            link.CommandArgument = CustInt
            str = link.CommandArgument

            AddHandler link.Click, AddressOf GetnameDetails

        Next ObjCustList

        ViewState.Item("nameload") = True.ToString

    End Sub

it not fire

Private Sub GetnameDetails(ByVal sender As Object, ByVal e As EventArgs)


        Dim getRecord As New CustomerBo
        Dim lbLink As LinkButton = CType(sender, LinkButton)
        Dim CustomerID As String = lbLink.CommandArgument
        Dim getLink As String = lbLink.Text
        Dim SendCustID As Integer
        SendCustID = CInt(CustomerID)
        getRecord.Cus_Id = SendCustID

        Dim getAllcatInfo As New customer
        getRecord = getAllcatInfo.R_List(getRecord)
        Panel1.Controls.Add(New LiteralControl("<table><tr>"))
        Panel1.Controls.Add(New LiteralControl("<td colspan=2 align=center    valign=middle >"))
        Panel1.Controls.Add(New LiteralControl(getRecord.FirstName))
        Panel1.Controls.Add(New LiteralControl("</td>"))
        Panel1.Controls.Add(New LiteralControl("<td>"))
        Panel1.Controls.Add(New LiteralControl(getRecord.LastName))
        Panel1.Controls.Add(New LiteralControl("</td>"))
        Panel1.Controls.Add(New LiteralControl("<td>"))
        Panel1.Controls.Add(New LiteralControl(getRecord.Telephone))
        Panel1.Controls.Add(New LiteralControl("</td></tr></table>"))
        ViewState.Item("Getnameload") = True.ToString

        'get product details here
    End Sub

what am doing wrong thank

My guess is that you've gone wrong here:

ElseIf ViewState.Item("Getnameload").ToString = "True" Then

I can't really see a path where the getname would fire as I can't find where

ViewState.Item("nameload").ToString = "True"

this would result in TRUE, but so I can't find a path where the elseif condition would result in TRUE.

In your program, is the getnameload state going to be true only if the nameload state is false? (That's how you've coded it). If it doesn't matter what nameload is when checking the getnameload then you should either end the 2nd if and start a new one or start a 3rd if without the else.