reuse gridview for different sql queries

G

Greg

Hi - Newbie here.


Is there a way to reset the gridview so that I can continue to use the same
gridview and sqldatasource, but alter the SelectCommand to display different
data?


I have one gridview, and one SQLdatasource. Depending on where the user
clicks, I change the "SelectCommand" of the SQLDataSource to query a
different table in the same database. The data displays correctly, but when
I try to sort, I receive an error - one example is "Cannot find column
Name" - the Column Name is visible, but I think the problem is that the
gridview is 'remembering' the schema of the first SelectCommand used to
display the query. Sorting works for me for the first grid that's displayed,
but for all others (because I change the SelectCommand), sorting fails, but
data is displayed correctly.

Any help you can offer would be greatly appreciated.

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top