
Mario
Posts: 14
|
| Posted: 04/04/2012, 3:54 AM |
|
Hello,
I have a database with several tables and each table has a different number of fields.
I would like to build a single grid that displays one table at a time (I can select from a listbox the table I want to show in the grid) but because of the different number of fields of each table I am having some problems...I don´t want to create a CCS page for each table but just one page with one grid that dinamically checks the number of fields of the selected table and then displays just those fields needed.
I have been checking the CCS documentation for some time:
- for instance, Dynamically Modify the SQL Statement in the help file :
Function Tasks_DataSource_BeforeBuildSelect(Sender)
Tasks.DataSource.SQL = "SELECT * FROM Tasks"
End Function
I guess that changing "from Tasks" to "from WhateverTableIHaveSelected" should work....
Any hints? (I don´t know if you have already noticed it but my expertise level is somehow set to "rookie")
Thanks in advance,
Mario
|
 |
 |
Lucius
Posts: 220
|
| Posted: 04/04/2012, 4:14 AM |
|
Hi Mario,
I would suggest a different approach, as re-using a single grid for this task will be very difficult and messy...
Create a page with 3 Grids and other components that you might need, package them into separate panels.
When you will use a listbox it should show 1 panel containing the grid you need and others will be hidden.
This way you have the same end-result (1 page with 3 different grids) but much cleaner and easy to maintain code behind it.
|
 |
 |
mor
Posts: 119
|
| Posted: 04/04/2012, 4:16 AM |
|
Mario,
Solution from Lucius - good idea. Simple and fast :)
_________________
Mor ve Ötesi |
 |
 |
Mario
Posts: 14
|
| Posted: 04/04/2012, 5:47 AM |
|
Thanks, I will try to implement it that way
A colleague here did something similar in Visual Basic coding from scratch: briefly, he created a mega-array with all the data (hidden) and then selected what needed and displayed it in the grid (no CCS at all). I tried to merge that code into CCS but not luck yet..
I´ll let you know...
Regards,
Mario
|
 |
 |
|

|
|
|
|