locked
Dynamic Data usage quick questions RRS feed

  • Question

  • User502787105 posted

    1 - I'm currently playing wuth Dynamic data and every now and then I run it it complains that It cannot find a table names Products - this is a weird one as it works for a while and then errors on the following line - System.Collections.IList visibleTables = MetaModel.Default.VisibleTables, try it again after rebuilding and it works without making any changes.

    2- I have used the Northwind db and 5 tables (Orders, Customers, Products, Employee and Order_detail and have the routing setup like so:-

    routes.Add(new DynamicDataRoute("Products/{action}.aspx") {
    Constraints =
    new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
    Model = model,
    Table =
    "Products"
    });

    // The following statements support combined-page mode, where the List, Detail, Insert, and
    // Update tasks are performed by using the same page. To enable this mode, uncomment the
    // following routes and comment out the route definition in the separate-page mode section above.

    routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
    {
    Action =
    PageAction.List,
    ViewName =
    "ListDetails",
    Model = model
    });

    routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
    {
    Action =
    PageAction.Details,
    ViewName =
    "ListDetails",
    Model = model
    });

     For the Orders table I was expecting the edit mode to be inline but its going to the Details view (non inline) and I cant see why - any ideas?

    Thursday, September 11, 2008 5:31 AM

All replies

  • User-797310475 posted

    1. It should work. Do you have any more info or a way of reproducing it in a consistent fashion?

    2. It seems like your routes are set up correctly. For the Products and Orders tables, what kind of URLs do you get for the list action (i.e. when clicking on the links from the main page)? Is Orders actually displayed using the ListDetails template (do you see both a GridView and a DetailsView)? Do you have any custom pages in the CustomPages folder?

    Thursday, September 11, 2008 7:05 PM
  • User2122965003 posted

    Try this:

                routes.Add(new DynamicDataRoute("SomeLink")
                {
                    Action = PageAction.List,
                    ViewName = "ListDetails",
                    Model = model,
                    Table = "Orders"
                });

                routes.Add(new DynamicDataRoute("SomeLink")
                {
                    Action = PageAction.Details,
                    ViewName = "ListDetails",
                    Model = model,
                    Table = "Orders"
                });

                routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
                {
                    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
                    Model = model
                });

     

    With this setup, only Orders table uses an inline edit mode, all other tables use the standard edit template.

    Hope it helps! 

    Friday, September 12, 2008 4:25 PM