1、VB.NET版的GridView经典使用 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then binddata() End If End Sub Public Sub binddata() ' End Sub '编辑中 Protected Sub GridView1_RowEdi
2、ting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing GridView1.EditIndex = e.NewEditIndex '当前编辑行背景色高亮 GridView1.EditRowStyle.BackColor = Color.FromName("#F7CE90") binddata() End
3、 Sub '分页 Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging GridView1.PageIndex = e.NewPageIndex binddata() '重新绑定GridView数据的函数 End Sub '
4、更新 Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating Dim clsB As New sqlDLTP.business Dim sqlstr As String Dim ds As New DataSet sqlstr = "s
5、elect hbdwno from etsshbd where hbdcnm='" & CType(GridView1.Rows(e.RowIndex).FindControl("TextBox1"), TextBox).Text.ToString().Trim() & "'" ds = clsB.queryitems(sqlstr) Dim wno As String = ds.Tables(0).Rows(0)(0).ToString().Trim() sqlstr = "update etsd