我有 Datagridview,它的值来自 sql datatable ,其中一个是填充 Datagridview 数据绑定事件:
If e.Row.RowType = DataControlRowType.DataRow Then
Dim dt As New DataTable
Dim Ct As Integer
Dim rspn As Integer
Dim textrspn As String
Dim RefNo As Label = CType(e.Row.FindControl("lblRefNo"), Label)
If CPayment.Revstatus(RefNo.Text, Ct, rspn, textrspn) Then
CType(e.Row.FindControl("lblRevResp"), Label).Text = textrspn.ToString
End If
End If
现在我想查找来自上面代码的 datagridview 值。我已经插入了一些这样的代码:
If DropDownList1.SelectedIndex = 1 Then
If Ct = 1 Then
CType(e.Row.FindControl("lblRevResp"), Label).Text = textrspn.ToString
Else
e.Row.Visible = False
End If
ElseIf DropDownList1.SelectedIndex = 2 Then
If Ct = 0 Then
CType(e.Row.FindControl("lblRevResp"), Label).Text = textrspn.ToString
Else
e.Row.Visible = False
End If
ElseIf DropDownList1.SelectedIndex = 0 Then
CType(e.Row.FindControl("lblRevResp"), Label).Text = textrspn.ToString
End If
它有效,但我做了一些棘手的事情,比如隐藏行。有没有更好的解决方案?