Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Gridview with changing Datasources in code - some things don't work

Reply
Thread Tools

Gridview with changing Datasources in code - some things don't work

 
 
jobs
Guest
Posts: n/a
 
      11-21-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView made by different datasources tsaprout ASP .Net 0 07-30-2008 11:52 AM
filling the same gridview wid from different datasources Shanksluvsuall ASP .Net 0 03-14-2008 11:27 AM
FormView and GridView with DataSources =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= ASP .Net 0 02-01-2007 09:09 AM
gridview switching datasources in the codebehind. ... Delete no longer happens. jobs ASP .Net 3 11-21-2006 04:52 PM
vs2005 publish website doing bad things, bad things =?Utf-8?B?V2lsbGlhbSBTdWxsaXZhbg==?= ASP .Net 1 10-25-2006 06:18 PM



Advertisments