More problems with DataGrid Editing while using custom Paging

L

lloyd

All,

i am running into more problems with DataGrid, following are my doubts

1) When i scroll to the next page on the dataGrid using my custom Next
button and if i click on Edit for lets say the third row on page two,
it refreshs and sets the first page row 3 for editing?
It always seems to go to the first page when i click the Edit button.

please note i have set allowCustomPaging=True, AllowPaging=True
for the dataGrid. Also i am using a stored procedure for paging the
records.

==================================
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs)Handles
DataGrid1.EditCommand

DataGrid1.EditItemIndex = CInt(e.Item.ItemIndex)
Datagrid_BindNow(True)

End Sub

Private Sub DataGrid1_PageIndexChanged(ByVal source As Object,ByVal e
As System.Web.UI.WebControls.DataGridPageChangedEventArgs)Handles
DataGrid1.PageIndexChanged

DataGrid1.CurrentPageIndex = e.NewPageIndex
Datagrid_BindNow(True)

End Sub


Private Function Datagrid_BindNow(Optional ByVal pageFirst As Boolean
= False)
Dim item As DataGridItem
If DataGrid1.Items.Count > 0 Then
item = DataGrid1.Items(DataGrid1.Items.Count - 1)
End If
Dim objClass1 As New DataSetClass.Class1()
If pageFirst = True Then
DataGrid1.DataSource = objClass1.Connect()
Else
DataGrid1.DataSource=objClass1.Connect(1,1,Trim(item.Cells(4).Text()),Trim
(item.Cells(6).Text()))
End If
DataGrid1.DataKeyField = "emp_id"
DataGrid1.VirtualItemCount = 200
DataGrid1.DataBind()
DataGrid1.DataKeyField = "emp_id"
objClass1 = Nothing
End Function

any ideas about this??

thanks in advance
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top