Prasad S M

Prasad S M

  • NA
  • 22
  • 0

How to add new row to datagrid after paging being done?

Nov 5 2008 12:45 AM
Hi All,

Glance this code..

" Public Sub CreateNewRow()
Dim index As Integer
index = StatusGrid.Items.Count
Dim da As New SqlDataAdapter
conn.Open()

da = New SqlDataAdapter("select * from Status", conn)

'New Row Creation
da.Fill(dt)
dt.Rows.Add(dt.NewRow)
'dt.Rows.InsertAt(dt.NewRow(), index)
StatusGrid.EditItemIndex = index
dt.AcceptChanges()
StatusGrid.DataSource = dt
StatusGrid.DataBind()
conn.Close()

End Sub"

With this code, I got new row in the datagrid.

But the problem Occurs, When the pagesize exceeds.

Here I have given pagesize as 10.

Assume there is 10 rows.Now When AddNewRow button is clicked, I should get new row in next page.(Total 11 rows).10 in first page and the new row in next page.

How can I get this?

Thanks in Advance...