K
KJ
I have a datagrid in which I filter on what is selected in a
dropdownlist.
It filters correctly, but when I select the value to take it back to
it's original state. I set the datasource to the original datatable
and nothing happens. My code is below:
Private Sub ddl1_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles ddlVendorSummary.SelectedIndexChanged
Dim strShortName() As String
Dim dv As DataView
m_dt = DirectCast(Session("dt"), DataTable)
strShortName = Split(ddl1.SelectedItem.Value, "-")
If UBound(strShortName) = 1 Then 'If a filter is selected
dv = m_dt.DefaultView
dv.RowFilter = "ShortName = '" & strShortName(0) & "'"
With dgNames
.DataSource = dv
.DataBind()
End With
Else 'If "ALL" is selected in the dropdownlist
With dgNames
.DataSource = m_dt
.DataBind()
End With
End If
End Sub
dropdownlist.
It filters correctly, but when I select the value to take it back to
it's original state. I set the datasource to the original datatable
and nothing happens. My code is below:
Private Sub ddl1_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles ddlVendorSummary.SelectedIndexChanged
Dim strShortName() As String
Dim dv As DataView
m_dt = DirectCast(Session("dt"), DataTable)
strShortName = Split(ddl1.SelectedItem.Value, "-")
If UBound(strShortName) = 1 Then 'If a filter is selected
dv = m_dt.DefaultView
dv.RowFilter = "ShortName = '" & strShortName(0) & "'"
With dgNames
.DataSource = dv
.DataBind()
End With
Else 'If "ALL" is selected in the dropdownlist
With dgNames
.DataSource = m_dt
.DataBind()
End With
End If
End Sub