Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:06:37+00:00 2026-05-28T03:06:37+00:00

I added a Dynamic Data web app as a second project to an MVC

  • 0

I added a Dynamic Data web app as a second project to an MVC 3 app. The Dynamic Data app references the derived EF 4.1 Context in the MVC 3 app (code first).

DefaultModel.RegisterContext(
    new EFCodeFirstDataModelProvider(() => new MvcApplication1.Models.Context()),
    new ContextConfiguration() { ScaffoldAllTables = true });

I want to try out a Dynamic GridView control but I don’t understand how to configure the DataSource control. The connection string from my MVC app didn’t work for the control. Nothing shows up in the control’s configuration wizard even after a build. I am totally webforms/datasource illiterate. Am I way off here? How do I do this?

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="WebApplication1.DynamicData.CustomPages.WebUserControl1" %>

<asp:GridView ID="GridView1" runat="server">
</asp:GridView>

<asp:DynamicDataManager ID="DynamicDataManager1" runat="server" />
    <DataControlReference ControlID="GridView1"/>
</asp:DynamicDataManager>

<asp:EntityDataSource ID="EntityDataSource1" runat="server">
</asp:EntityDataSource>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:06:38+00:00Added an answer on May 28, 2026 at 3:06 am

    DD templates are way behind.

    Add this to a file:

    using System.Linq;
    using System.Web.DynamicData;
    using System.Data.Objects;
    using System.Data.Objects.DataClasses;
    public static class ModeContainer<OC> where OC : ObjectContext
    {
        private static MetaModel model = new MetaModel();
        static ModeContainer() { model.RegisterContext(typeof(OC), new ContextConfiguration() { ScaffoldAllTables = true }); }
        public static MetaModel Model { get { return model; } }
        public static MetaTable Table<EO>() where EO : EntityObject { return Model.Tables.First(x => x.EntityType == typeof(EO)); }
    }
    

    Then Global can contain this:

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

    And then you can do things like this in a page to use dynamic outside of the route:

    protected void Page_Init(object sender, EventArgs e)
    {
        MetaTable table = ModeContainer<ContactsModel.ContactsEntities>.Table<Person>();
        GridView1.SetMetaTable(table);
    }
    

    Along side of grid and source like this:

    <asp:GridView ID="GridView1" runat="server" DataKeyNames="Id" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
        <SelectedRowStyle BackColor="Azure" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
            <asp:DynamicField DataField="Contacts" />
            <asp:DynamicField DataField="Addresses" />
        </Columns>
    </asp:GridView>
    
    
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=ContactsEntities" DefaultContainerName="ContactsEntities" EntitySetName="People" EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeFilter="Person">
    </asp:EntityDataSource>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Dynamic Data application to which I have added a class for
I've added in the Dynamic Data stuff to our existing website, and gotten that
I've created a new web site based on the 'Dynamic Data Site' template. Three
I'm developing a dynamic data app, in which I'm trying perform insert RequestRevision during
I have a dynamic number of data elements that need to be added to
I have just added the Dynamic Data Filtering library to an Entity Framework based
I have added some dynamic textboxes upon a button click. I need the values
I added some simple WatiN tests to our app today to check that a
I am trying to use the Dynamic Data Display library for WPF in my
I have a web application that has a dynamic javascript calendar, which allows users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.