Friday

Possible use of DetailsView in Projects

As was discussed during Wednesday’s help session, the complexity of the use of GridVeiw in combination with DetailsView for the project can be increased with the use of several tables.

In this case (as it is done in real work places) one table might represent a more global view with multiple foreign keys. For example, the table Employees might contain department where they work, current project that they participate in, etc. These additional entities (departments, projects, others) are represented by some id/foreign key and have respective separate tables describing them in more detail.

Then the Interface might be designed in a way when the user selects a particular employee while browsing or searching, additional tables describing details of the department, project, etc. are automatically shown. Note that there could be several logically grouped attributes from the same employee table describing some specific attributes of the employee (like salary, recent promotion, etc.) that do not have to appear in the main GridView of the Employees table. This will offer even more design flexibility and make the UI (user interface even more attractive). The key to the connection of the corresponding rows from various tables to the main browsing activity of the Employee GridView can be achieved in a very simple way (along with other possible methods) just be indicating that the key of the Specific Table equals to the corresponding foreign key of the main browsing table in the GridView control (as was described in the previous post on connecting DetailsView and GridView controls).

Wednesday

Connecting DetailsView and GridView

The method of using a separate data source control that can be used by any server control that can feed on external data is very productive. Like XML allows the separation of content from the the presentation and client-side manipulation - such separation allows for painless change of data sources to different tables, databases, file systems without changing the way your site looks and functions.

For more user convenience you might want to create a relationship between the GridView and DetailView so that DteailsView shows the record that has been selected in the GridView. For any operations using SqlDataSource differently in different controls you need to create another SqlDataSource2 by dropping it on the design view. Then configure the second SqlDataSource2 for the same table but using WHERE clause and choosing Column = "key field of the table" (for example "id"), Operator will be "=", Source = "control", and control (that delivers the value for key) will be GridView1 (or whatever control you are synchronizing the DetailsView with).