.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Automatically set a property value for a new record in a Dynamic Data application.

Posted By:      Posted Date: August 23, 2010    Points: 0   Category :ASP.Net

I have a SalesOrderItem table, and it has a UnitPrice column in case the salesperson wishes to override the unit price of the Product for that order item.

In an ASP.NET Dynamic Data application, what would be the best way to set that UnitPrice property on a new SalesOrderItem based on the standard UnitPrice for the product? In other words, when the user clicks New on the 'Items' screen for a sales order, the UnitPrice field should already be filled in with the normal unit price for the product.

This was originally asked by myself on StackOverflow at: http://stackoverflow.com/questions/3538234/automatically-set-a-property-value-for-a-new-record-in-a-dynamic-data-application

View Complete Post

More Related Resource Links

What is a good example Dynamic Data application?


I'm giving a demonstration of Dynamic Data to a bunch of geeks in two weeks time. I'm looking for a simpe, but comprehensive data model to build the application on. I basically just want to register the model and demonstrate the application, as built (scaffolded) without any customisation, to start with, demonstrating list and detail/edit/insert views, and how table relations are handled.

I'd like to avoid one of the standards, i.e. the Customer->Order-OrderItem models, and try something that would be of interest to geeks. Maybe a Srum project tracker, an or a bug tracker, something like that.

Any suggestions please?

This was originally asked by myself on StackOverflow at: http://stackoverflow.com/questions/3536803/what-is-a-good-example-dynamic-data-application

Cannot INSERT record using Asp.Net Dynamic Data Domain Service Web Applications

 Hi, I am working on a 'Asp.Net Dynamic Data Domain Service Web Application' project using just 2 tables, FAQ_Categories and FAQs. The FAQs table has a foreign key to the FAQ_Categories. The steps are straight forward. Add a new project (Asp.Net Dynamic Data Domain Service Web Applications) Add folders Model ( for Linq2Sql datacontext), Domain (for the Domain Services class) Add Linq2Slql and add the 2 tables to the designer. Build the project. Add the Domain Service Class to the Domain folder. in the wizard select the DataContext, uncheck the Enable Client & Expose ODate checkbox Check bothe table & their corresponding Enable Editing tables checbox Check the Generate Metadata class Click OK. In Global.asax set Scaffold to true and add the DomainService name. Build and run.   Pages List and Detail are working fine. But if I try to insert a new record, I get the error "FaqId is required" Faq_ID is the primary key in the database table and it is set to Identiy. The Datacontext is correct, it marked the FAQ table with <Global.System.Data.Linq.Mapping.ColumnAttribute(Storage:="_CustomerId", AutoSync:=AutoSync.OnInsert, DbType:="Int NOT NULL IDENTITY", IsPrimaryKey:=true, IsDbGenerated:=true)> _   I tried this using Linq2Sql, Entity Framework, And both in VB and C# with the same result. I am using VS20

Inserting methods in Dynamic Data Application


I am trying to build aa hotel management application using Dynamic data. I need to create an event and add methods to calculate applicable room charges based on the duration of stay. For example;

TotalRoomCharge = DurationOfStay*RoomRate

TotalRoomCharge, DurationOfStay and RoomRate are all columns in my database table.

I have already generated the dynamic data site in my application.

Change Default Sort for Dynamic Data Web Application




I just created a dynamic data web application and setup a simple .EDMX file. Next, I created meta-data / partial classes to ensure that my integer identifiers wouldn't show up:

// ...


public object TableId { get; set; }

 // ...

I wanted to now set the up the list pages so they sort using a different attribute ("Name" in this case). Anyone know if this is possible / how to do it?






Creating Custom Page in Dynamic Data Application


To create a custom page I copied the List.Ascx file from the Page templates to DynamicData\CustomPage\"MytableName"

I keep getting the follwing errors mainly in list.aspx.designer

"The type 'L2SDynamicData.List' already contains a definition for GridView1"

"The type 'L2SDynamicData.List' already contains a definition for table1"

"The type 'L2SDynamicData.List' already contains a definition for HeadContent"

"The type 'L2SDynamicData.List' already contains a definition for DynamicDataManager1"

"The type 'L2SDynamicData.List' already contains a definition for UpdatePanel1"


There are about 32 of these error types



Creating Custom Page in Dynamic Data Application


To create a custom page I copied the List.Ascx file from the Page templates to DynamicData\CustomPage\"MytableName"

I keep getting the follwing errors mainly in list.aspx.designer

"The type 'L2SDynamicData.List' already contains a definition for GridView1"

"The type 'L2SDynamicData.List' already contains a definition for table1"

"The type 'L2SDynamicData.List' already contains a definition for HeadContent"

"The type 'L2SDynamicData.List' already contains a definition for DynamicDataManager1"

"The type 'L2SDynamicData.List' already contains a definition for UpdatePanel1"


There are about 32 of these error types



Data structure to automatically sync data between windows application and Microsoft SQL Server



I dont know whether I am posting this question in the right forum, please move it if needed. I have a windows application that shows data from a SQL table. I cannot use DataGridView in the application, I have a custom form to display the data. I need a datastructure to hold the table data and I display it using my custom windows form. Which data structure should I use to automatically sync data between windows application and SQL Server? I don't want to manually write Update queries. Any help would be appreciated.

Dynamic Data Templates in GridView ASP.NET 3.5

At a high level, Dynamic Data Templates can be seen as a system to very quickly build up a User Interface linked with the relevant data model, immediately enabling you to perform CRUD operations (Create, Read, Update, Delete) on the database using the specified data source. They provide a powerful method for building up these kinds of applications, and I'm going to focus on an overview of what Dynamic Data Templates actually are, and a few ways of customizing them to suit industry needs.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

ASP.NET 4.0 Dynamic Data and Many to Many Entity Framework Entities

I did not play much with Dynamic Data controls in VS2008 and just made a cool discovery in VS2010 Beta 2. This may not even be new, but as I'm sitting 30,000+ feet over the Atlantic ocean, I don't have access to VS2008 at the moment to check.

Creating a Smartphone Application and Using Data from SQL Mobile

In this exercise, you will use Visual Studio 2005 to create a Smartphone application. You will associate commands with a mobile device's soft keys, and you will add the ability to scroll through the list of available products (a list of images). You will create a data source for an existing SQL Mobile database, and then test the application in the Windows Mobile 5.0 emulator.

In the following procedure, you will create a new Windows Mobile 5.0 project in Visual Studio.



Dear gentlemen and ladies of the Microsoft Dynamic Data Team,

Mr. Steve Naughton says (and I hope so) that there might be chances that you read the posts published in this forum: I really hope so.

If that were the case then I am formally requesting to you in providing a "real answer" to my question:

I want to customize a dynamic data page (the details one) so I can have access to the data it has been already gathered from the end user UI (details.aspx) and use it to pass this same data to the following controls/pages that I am going to display next time to the end user.

For instance:

I have a screen with different types of data in it: texts, numbers, dates, check boxes, radio buttons and dropdownlists that has been filled with data by the end user. I want now to reset all fields exept the dropdownlist of which I'd like to keep the previously chosen values(the very same thing you do between dropdownlist of List.aspx ad Details.aspx). Even with FoxPro I could do that because data and controls were available there. It was as simple as setting carrying on to true.


I have found my

Routing in dynamic data applications


Im using ASP.Net 4. I tried to modified the code according to following video tutorial. http://www.asp.net/aspnet-in-net-35-sp1/videos/how-to-enable-table-specific-routing-in-dynamic-data-applications

But Product page directs only to ListDetails.aspx page.

This is my code :

<%@ Application Language="C#" %>
<%@ Import Namespace="System.ComponentModel.DataAnnotations" %>
<%@ Import Namespace="System.Web.Routing" %>
<%@ Import Namespace="System.Web.DynamicData" %>

<script RunAt="server">
    private static MetaModel s_defaultModel = new MetaModel();
    public static MetaModel DefaultModel {
        get {
            return s_defaultModel;

    public static void RegisterRoutes(RouteCollection routes) {

        DefaultModel.RegisterContext(typeof(NorthwindDataContext), new ContextConfiguration() { ScaffoldAllTables = true });


About Dynamic Data in Visual Studio 2010 / .NET 4



Does anybody here have any pointers to screencasts, demos, webcasts for the latest enhancements in Dynamic Data as listed in above link? I'm repeating them here for ready reference :


  • EnableDynamicData method which enables Dynamic Data features in existing ASP.NET applications and DataSource controls
  • A new QueryExtender control, contained in the sample projects to simplify common data filtering operations. It supports a rich ASP.NET declarative query syntax that makes it easy to do things like search data for text or have filters based on ranges
  • A new Dynamic Data filter model that enables the developers to apply templates to pages just like field templates (including user defined filters)
  • New field templates of Email, URL and Enum columns
  • Support for inheritance in Entity Framework and Linq to SQL
  • Support for many to many relationships in Entity Framework
  • New Entity Templates which allow fine control over how an object is displayed and edited
  • DynamicHyperLink control for building links to tables and actions
  • Declarative support for D

How to sell Dynamic Data to the bosses


I have a project which has gone from Excel report to a SharePoint Custom List and now they have tried to make it an application growing legs with additional list hinging off it and no real way to clean up data from one when it deleted from another etc..(unless we add handlers etc which we don't want to do).

It was envisiaged as a simple one page list to generate some reports off of but it more a data driven application they want now.

I am looking into a way after stating this to my boss and am intrested in the quickest most flexible way to achieve this and to sell it to him.

I am more a .net person but also know plsql and most of the team I work with are Oracle specialists.

We currently have at are disposile .net, php and oracle products (portal, plsql, forms and oracle application express.)

We are at a transition stage trying to move away from Oracle Forms and I believe that .net is a better fit that php for production and readability of code.

So I am considering placing Dynamic data on the table for this project as it all data driven with data being inputed and manipulated and then reports being generated (either via code or we could hitch in a reporting tool like mssql or discover.)  The main issue will be the data will be in Oracle so if Dynamic data can handle this then it be perfect as

Dynamic Data, Domain datasource, Poco and lookups


Mr. Edward,

Excuse my question but: it is necessary to involve in our projects something more than just Dynamic Data or should we make use of all other features available in VS2010 (which will make assume taht they had been left out of the Dynamic Data framework) like: wef, poco, azure, wcf, cloud, mvc, silverllight, ajax, odata, agile, workflow, etc.?

Sorry my ignorance, I'm just transcribing names as they come to my mind and of which I don't know anything about


Carlos Porras (El Salvador)

Microsoft Application Block for Data Access in .NET


Hi all,

I was rummaging the internet learning aspx and came across the concept of: Microsoft Application Block for Data Access in .NET

It seems great of course. The articles are all early 2003-5 such as


So the question is - is this tech still relevant and should I be using it?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend