Imports System.Data

Partial Class InsertForm
    Inherits System.Web.UI.Page
    Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click

        InsertNewRow()

    End Sub
    Private Sub InsertNewRow()
        Dim sourceTable As DataTable = Session("gridSource")
        Dim newRow As DataRow = sourceTable.NewRow()

        newRow("EmployeeID") = CType(sourceTable.Rows(sourceTable.Rows.Count - 1)("EmployeeID"), Integer) + 1
        newRow("FirstName") = TextBox1.Text
        newRow("LastName") = TextBox2.Text
        newRow("Title") = TextBox3.Text

        sourceTable.Rows.Add(newRow)

        InjectScript.Text = "<script type='text/javascript'>CloseAndRebind('navigateToInserted')</" + "script>"
    End Sub
End Class
