GridView insert button

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

Is it possible to, instead of having the GridView Insert in each
GridView row, have it before the GridView or maybe in the GridView
footer?

Thanks,
Miguel
 
If you want to insert a row in the Grid then you can add a button in the
footer of the grid in the rowcreated event and then

Dim btnAdd As New LinkButton()
btnAdd.Text = "AddNew"
' add a handler for the click event AddHandler btnAdd.Click,
AddressOf AddNew_Click
e.Item.Cells(0).Controls.Add(btnAdd)

and put the grid in the edit mode

Me.OleDbDataAdapter1.Fill(Me.DataSet21)
Dim table As DataTable = Me.DataSet21.Tables(0)
Dim row As DataRow = table.NewRow()
row.EndEdit()
table.Rows.Add(row)
Me.gridview1.EditItemIndex = table.Rows.Count - 1
Me.gridview1.DataBind()

then you can enter your data and then update the grid with the update button
and set its updatequery in the sqldatasource.

Regards,
Manish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top