This is my code behind
Private Property ListEmployee As List(Of Employee)
Get
Return Session(Me.GetType.Name)
End Get
Set(ByVal value As List(Of Employee))
Session(Me.GetType.Name) = value
End Set
End Property
Private ReadOnly Property objEmployee As Employee
Get
Dim obj As New Employee
obj.User_ID = txtUserID.Text.Trim
obj.Name = txtName.Text.Trim
obj.Position = txtPosition.Text.Trim
Return obj
End Get
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub btnAddtoTable_Click(sender As Object, e As EventArgs) Handles btnAddtoTable.Click
ListEmployee.Add(objEmployee) 'error at here
gvResult.DataSource = ListEmployee
gvResult.DataBind()
End Sub
End Class
i try to add data as (Class Employee) into ListEmployee as (List of Employee) and then display on gridview but i got an error.