Answered by:
How to change the following code in VB.net in order to use it in asp.net

Question
-
User803642803 posted
How to change the following code in VB.net in order to use it in asp.net using VB , I got the following errors:
- row is not member of GridView
-
Me.Qty.Index in not member of GridView
For Each rows As DataGridViewRow In Me.InvoiceDetailsDataGridView.row If Row.Cells(Me.Qty.Index).Value = "" Then Exit For strSQL = "INSERT INTO InvoiceDetails (InvoiceID, Qty, ProductName, Price) VALUES(" & identity & ", " & Row.Cells(Me.Qty.Index).Value & ",'" & Row.Cells(Me.ProductName.Index).Value & "'," & Row.Cells(Me.Price.Index).Value & ")" cmd = New SqlCommand(strSQL, conn) cmd.ExecuteNonQuery() Next Row
Sunday, September 18, 2016 3:45 PM
Answers
-
User36583972 posted
Hi Ayman Qadah,
row is not member of GridViewFor Each rowall As GridViewRow In GridView1.Rows If rowall.RowIndex = rowIndex Then Else End If Next
Me.Qty.Index in not member of GridViewYou need to check whether there is a variable in your context.
Best Regards,
Yohann Lu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, September 20, 2016 4:10 AM -
User3690988 posted
Instead of Me.Qty.Index use the column number of Qty -1.
For example, if QTY is the first column it would be Row.Cells(0).Text. You also have to do that for Me.ProductName.Index and Me.Price.Index
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 22, 2016 5:25 PM
All replies
-
User36583972 posted
Hi Ayman Qadah,
row is not member of GridViewFor Each rowall As GridViewRow In GridView1.Rows If rowall.RowIndex = rowIndex Then Else End If Next
Me.Qty.Index in not member of GridViewYou need to check whether there is a variable in your context.
Best Regards,
Yohann Lu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, September 20, 2016 4:10 AM -
User803642803 posted
Thank very much for you help<br>
Qty is the name of the column in the grid <br>
What i sould change in me.qty.index in order to work with my cod<br>
Thank youWednesday, September 21, 2016 9:36 PM -
User3690988 posted
Instead of Me.Qty.Index use the column number of Qty -1.
For example, if QTY is the first column it would be Row.Cells(0).Text. You also have to do that for Me.ProductName.Index and Me.Price.Index
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, September 22, 2016 5:25 PM