[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

Dynamic Data Make Table Read-Only

What is the easiest way to make a table Read-Only in a Dynamic Data web application WITHOUT having to make a custom page for each table?  Can you do this in the routing...or using partial classes???  VB.NET code only please :)
0
natek11
Asked:
natek11
  • 2
  • 2
1 Solution
 
Bob LearnedCommented:
Hmmm...that is a pretty vague question, since you might be talking about an HTML table, a DataTable, a database table, ...
0
 
natek11Author Commented:
A Dynamic Data site automatically builds classes and web pages to view/add/edit/delete from database tables.  So basically I need to set the configuration in the site to make the automatically generated page for certain database tables not contain add/edit/delete functionality.

I think I can maybe do it with routing...but I'm still trying to figure it out.
0
 
Bob LearnedCommented:
Great, you are talking about something that I haven't gotten to yet, since I don't have access to ASP.NET 3.5...
0
 
natek11Author Commented:
You should definitely check out 3.5 - LINQ and Dynamic Data are both really handy.

I ended up solving this by creating a custom version of the ListDetails.aspx page and using custom routing in the Global.asax.vb file to look at a hard coded ArrayList of table names.  Probably not the best way, but it worked.
For Each s As String In Functions.GetROTableNames
            routes.Add(New DynamicDataRoute(s & "/ListDetailsRead.aspx") With { _
                .Action = PageAction.List, _
                .ViewName = "ListDetailsRead", _
                .Model = model, _
                .Table = s})
        Next s
 
        routes.Add(New DynamicDataRoute("{table}/ListDetails.aspx") With { _
            .Action = PageAction.List, _
            .ViewName = "ListDetails", _
            .Model = model})
 
        routes.Add(New DynamicDataRoute("{table}/ListDetails.aspx") With { _
            .Action = PageAction.Details, _
            .ViewName = "ListDetails", _
            .Model = model})

Open in new window

0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now