let say i have 2 text box, 1 button and 1 gridview and i want to add data from textboxs to gridview with a button click.
How can I achive it.
I have tried below code but it replaced the old row.
Private dt As New DataTable
Private Sub Btnidadd_Click(sender As Object, e As EventArgs) Handles Btnidadd.Click
dt.Columns.Add("First Name")
dt.Columns.Add("Last Name")
Dim R As DataRow = dt.NewRow
R("First Name") = textbox1.Text
R("Last Name") = textbox2.Text
dt.Rows.Add(R)
GridView1.DataSource = dt
GridView.DataBind()