May 18

Dynamic data pages: listing your tables and views

Posted in ASP.NET      Comments Off on Dynamic data pages: listing your tables and views

The DynamicNavigator control does what its name tell you: it”ll build you a list that lets you navigate to pages that show your table”s data. As you might expect, the control will use an ASP.NET UI control (in this case, a Menu) to list the tables/views presented on your db.

It”s important to note that, by default, the control will only list the tables whose name match existing pages in your app. For instance, going back to the previous example, if you only have a page name Students and you add a DynamicNavigator to a page, you”ll only get an entry called Students that points to your Students.aspx page.

This can be changed by tweeking the showAlltables attribute of the dynamicDataControls element in the web.config section. Setting it to true is all that it takes for the control to show you a complete list of tables and views. And in this case, it”ll let you navigate to an automatically generated page, if there isn”t one with the name of the table, or to an existing page that has the same name as your table.

Before ending this short post, I believe there”s still time to mention the 2 new properties exposed by the control: IncludeTables and IncludeViews. They do exactly what you think: they let you choose if you”re showing the tables,the views,both or none (which is a dumb thing to do, but possible, since you can set bot properties to false).