【发布时间】:2013-06-03 06:06:37
【问题描述】:
我有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
它有效,但我做了一些棘手的事情,比如隐藏行。有没有更好的解决方案?
【问题讨论】:
标签: asp.net vb.net search gridview data-binding