我正在尝试更新gridview中的多个文本框字段。
但是我收到了这个错误:
'的rowIndex'不是会员 ' System.Web.UI.WebControls.GridViewCommandEventArgs'
以下是我尝试使用的代码:
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
If (e.CommandName = "Update") Then
Dim objVen As New ISISVendor.VendorInterfaceClient
Dim POResp As New ISISVendor.PoSummaryResponse
Dim ASN As New IsisEDI.ShipNotice_
Dim POPart As New ISISVendor.PoDetailResponse
Dim edi As New IsisEDI.IsisEdiWebServiceClient
Dim resp As New IsisEDI.GenericResponse
Dim svc As New IsisEDI.IsisEdiWebServiceClient()
Dim Itemx() As IsisEDI.Item
POPart = objVen.GetPoDetail("" & Session("POTransfer") & "")
For j As Integer = 0 To POPart.PoDetail.Parts.Count - 1
Dim tx1 As TextBox = CType(gvvParts.Rows(e.RowIndex).FindControl("TextBox1"), TextBox)
Dim tx2 As TextBox = CType(gvvParts.Rows(e.RowIndex).FindControl("TextBox2"), TextBox)
Itemx(j).PartNumber = gvvParts.Rows(j).Cells(0).Text
Itemx(j).ShipQuantity = "" & tx1.Text.Trim & ""
Itemx(j).ShipDate = CDate("" & tx2.Text.Trim & "")
ASN.Items = Itemx
svc = New IsisEDI.IsisEdiWebServiceClient()
resp = svc.ProcessASN(ASN)
Next
End If
End Sub
我的Gridview的ASP.NET代码:
<asp:GridView ID="gvvParts" OnRowUpdating="GridView1_RowUpdating" AutoGenerateColumns="False" class="table table-striped table-bordered table-hover" runat="server" Width="681px">
<Columns>
<asp:BoundField DataField="PartNumber" HeaderText="PartNumber" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity" />
<asp:TemplateField HeaderText="Quantity Shipped">
<ItemTemplate>
<asp:TextBox ID="TextBox1" Text='<%#Bind("shipped")%>' runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date Shipped">
<ItemTemplate>
<asp:TextBox ID="TextBox2" Text='<%#Bind("date")%>' runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>