0

I am doing the school project for ASP.net in Visual Basic and trying to do the updating through gridview but somehow doesn't work at all.

Mind to help.....?

Dim ProductName, SupplierID As String
        Dim qty, price As Integer
        REM Dim key As Integer = GridView1.DataKeys.Item(e.RowIndex).Value
        Dim tb As TextBox

        tb = CType(GridView1.Rows(e.RowIndex.ToString).Cells(2).Controls(0), TextBox)
        ProductName = tb.Text

        tb = CType(GridView1.Rows(e.RowIndex.ToString).Cells(3).Controls(0), TextBox)
        SupplierID = tb.Text

        tb = CType(GridView1.Rows(e.RowIndex.ToString).Cells(4).Controls(0), TextBox)
        qty = Convert.ToInt32(tb.Text)

        tb = CType(GridView1.Rows(e.RowIndex.ToString).Cells(5).Controls(0), TextBox)
        price = Convert.ToInt32(tb.Text)



        Dim r As Dataedit.ProductsRow

        r.ProductName = ProductName
        r.SupplierID = SupplierID
        r.QuantityPerUnit = qty
        r.UnitPrice = price


        GridView1.EditIndex = -1
        GridView1.DataBind()
Attachments 1.jpg 55.72 KB 2.jpg 69.5 KB
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
0

>trying to do the updating through gridview but somehow doesn't work at all.

Execute update query or invoke Update method of DataAdapter.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.