私は Datagridview を持っています。値は sql datatable から取得され、そのうちの 1 つは 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
それは機能しますが、行を非表示にするなどのトリッキーなことをします。より良い解決策はありますか?