J
jobs
Is there a correct way to change the datasourceId of a gridview in
codebehind so that things like sorting, paging and deleting actually
work?
Or will have have to have one one to one relationship between
datasources and gridviews?
when I switch datasources - deletes don't happen and I get erros like
this when I try to page or sort:
The GridView 'RateGridView' fired event Sorting which wasn't handled.
Here's how I switch:
RateGridView.DataSourceID = Nothing
RateGridView.DataSource = Nothing
ChargeGridView.DataSourceID = Nothing
ChargeGridView.DataSource = Nothing
If StatusLabel.Text = "" Then
If Hcheck.Checked Then
RateGridView.DataSource = RateGridSourceAll
ChargeGridView.DataSource = ChargeGridSourceAll
Else
RateGridView.DataSource = RateGridSource
ChargeGridView.DataSource = ChargeGridSource
End If
ChargeGridView.DataBind()
RateGridView.DataBind()
End If
Else
codebehind so that things like sorting, paging and deleting actually
work?
Or will have have to have one one to one relationship between
datasources and gridviews?
when I switch datasources - deletes don't happen and I get erros like
this when I try to page or sort:
The GridView 'RateGridView' fired event Sorting which wasn't handled.
Here's how I switch:
RateGridView.DataSourceID = Nothing
RateGridView.DataSource = Nothing
ChargeGridView.DataSourceID = Nothing
ChargeGridView.DataSource = Nothing
If StatusLabel.Text = "" Then
If Hcheck.Checked Then
RateGridView.DataSource = RateGridSourceAll
ChargeGridView.DataSource = ChargeGridSourceAll
Else
RateGridView.DataSource = RateGridSource
ChargeGridView.DataSource = ChargeGridSource
End If
ChargeGridView.DataBind()
RateGridView.DataBind()
End If
Else