As we”ve seen, by default pages must have the same name as the table from which it gets the data that it presents to the user. And what if you want to supply several views of your data? Or if you don”t really want to expose your table? In that case, you must change some of the attributes presented on the <dynamicDataControls> section. In order to illustrate the steps you must follow, lets make some modifications to the example we”ve been using on this series.
As you might recall, we have a very simple database that only has 2 tables: Students and Contacts. If we add the following to the web.config file:
<dynamicDataControls showAllTables=”true” listView=”stud” detailsView=”stud2″>
<add table=”students” pathPrefix=”~/stud” />
<add table=”contacts” pathPrefix=”~/conts” />
With these entries, we”re saying that Student”s table info will be found inside the stud directory. On the other hand, contact info should be obtained from the conts folder. If you open your browser and point it to the auto.axd handler I”ve mentioned here, you”ll see that when you try to get info from the students table, you”re automatically redirected to the stud directory (getting something like http://localhost:52508/dynamicwebsite/stud/list.aspx). The name list.aspx is important and has special meaning for dynamic data pages applications. By default, it should have code that shows a list of the items presented on your table. Besides the special list.aspx url, there”s also the details.aspx. you can customize both of these urls by setting the listView and detailsView attributes on the dynamicDataControls element. For instance, the next example changes these names to lista and detalhes (portuguese for the names used by default):
<dynamicDataControls showAllTables=”true” listView=”lista” detailsView=”detalhes“>
As you might expect,you”re supposed to have pages inside the previous folders that personalize the DynamicList and DynamicDetails controls used to present info about those tables. It”s important to notice that these names are only important when using the automatic navigation features that are provided by the dynamic data controls. Do notice also that you can have more pages inside your folder with different views of your data.