当我尝试通过单击编辑来编辑可编辑的网格视图时 按钮。 (当没有插入数据时)我导航到下一页 grid.i看到我编辑的网格行正在打开进行编辑 没有点击编辑按钮。在网格的第1页(第1张图片)中你可以 看到我正在尝试编辑第6行
在网格的第二页中,您可以看到第6行更改为 可编辑模式,甚至没有点击编辑按钮
vb.net代码
Protected Sub BindGridSubMeter()
Dim conMRI As New ConnectionMRI()
Dim ds As DataSet = conMRI.NabersSubMetergetData(ddlBldgId.SelectedItem.Value, ddlRating.SelectedItem.Value)
TextExclusions.Text = ds.Tables(1).Rows(0).Item(0).ToString()
UpdatePanelExclusions.update()
With GridSubMeter
.DataSource = ds.Tables(0)
.DataBind()
End With
End Sub
Protected Sub GridSubMeter_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridSubMeter.RowEditing
GridSubMeter.EditIndex = e.NewEditIndex
Me.BindGridSubMeter()
End Sub
Protected Sub GridSubmeter_PageIndexChanging(sender As Object, e4 As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridSubMeter.PageIndexChanging
GridSubMeter.PageIndex = e4.NewPageIndex
Me.BindGridSubMeter()
End Sub
答案 0 :(得分:0)
您没有重置EditIndex
上的PageIndexChanging
。编辑索引基于可见项,而不是总计。
Protected Sub GridSubmeter_PageIndexChanging(sender As Object, e4 As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridSubMeter.PageIndexChanging
GridSubMeter.EditIndex = -1
GridSubMeter.PageIndex = e4.NewPageIndex
Me.BindGridSubMeter()
End Sub