Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > reuse gridview after changing data datasource parameters

Reply
Thread Tools

reuse gridview after changing data datasource parameters

 
 
Greg Ramsey
Guest
Posts: n/a
 
      03-19-2006
Hi - I'm a real newbie to ASP . . so please forgive me. . . and please point
me in the right direction for how to do this "the right way" . .

Using Northwind DB as an example, I have a gridview bound to a
sqldatasource, with a SelectQuery = SELECT [ProductName], [QuantityPerUnit],
[UnitPrice], [UnitsInStock] FROM [Alphabetical list of products]

That all works fine. . . but what I want to do next is this: Users clicks on
button "Customers and Suppliers By City", and the code for the button simply
sets SelectCommand = SELECT * FROM [Customer and Suppliers by city]

This obviously bombs when I click on the button, and it states that
"ProductName" as not found on the selected data source.

I hate to think of creating a separate gridview and datasource for each
Table I desire to display. . . Is there any way I can "reset" the gridview
so that it pulls the proper schema from the "updated" datasource before
rendering in the display? I've tried databind() for both sqldatasource and
gridview.

Any examples you could point me to would be greatly appreciated.

Greg


 
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
To reuse or not to reuse jacob navia C Programming 19 12-18-2006 07:22 AM
Reuse DataSource with multiple user controls Amil Hanish ASP .Net 0 08-21-2006 12:37 PM
code reuse and design reuse sailor.gu@gmail.com C Programming 16 02-12-2006 09:09 PM
Reuse paramter list and reuse connection tshad ASP .Net 5 05-17-2005 12:33 AM
To reuse or not to reuse.... Hylander Java 0 02-26-2004 12:00 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57