Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Controls / August 2005

Tip: Looking for answers? Try searching our database.

Dynamic DataGrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CanoeGuy - 29 Aug 2005 21:58 GMT
I am wanting to dynamically display different columns in a DataGrid based on
what item the user chooses.  As an example, if the user chooses Item A, I
want to display column1, column2, and column5.  If the user chooses Item B, I
want to display column1, column2, column8 and column9.  The columns that will
not be displayed to the user are always either Null or 0 (zero).  I haven't
been able to find a working example or a solution anywhere in my research.

Thanks in advance for the help.
Signature

Joe Goeke

Curt - 30 Aug 2005 04:03 GMT
This is a BIG question , in that you can configure a DataGrid in so many
different ways!  The right anwser depends on the way you are using the
DataGrid.

I almost always solve such questions in the core SQL itself, by writing the
SQL to match the columns required.  Less coding is necessary to bind such
data to a DataGrid object this way, and just about any SQL you write will
work.

If you are creating the DataGrid in code, of if dynamic SQL is not an
option, then leverage static SQL by adding only the required columns to your
DataGrid.  There are tons of examples of how to do this on the web.   Here
are two starters:
http://odetocode.com/Articles/218.aspx
http://www.c-sharpcorner.com/Database/PlayingWithDataGridTA.asp

Good luck,
Curt

>I am wanting to dynamically display different columns in a DataGrid based
>on
[quoted text clipped - 8 lines]
>
> Thanks in advance for the help.
CanoeGuy - 30 Aug 2005 15:30 GMT
Hi Curt,

Thanks for your reply.  Believe it or not it answers the big question that I
had of whether I should handle the data in the SQL or in the DataGrid.  Can
you help me on the best way to filter out Null fields in the SQL Statement?  
As long as I can get started, I can do the rest of the research.

Thanks,

//Joe
Signature

Joe Goeke

> This is a BIG question , in that you can configure a DataGrid in so many
> different ways!  The right anwser depends on the way you are using the
[quoted text clipped - 27 lines]
> >
> > Thanks in advance for the help.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.