Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,15 @@
When you apply this attribute to a data field, you must follow the guidelines for the use of the attributes. For more information, see [ASP.NET Dynamic Data Guidelines](/previous-versions/aspnet/cc668215(v=vs.100)).

## Examples
See an online example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.ComponentModel.DataAnnotations.DisplayFormatAttribute).

The following example shows how to use the <xref:System.ComponentModel.DataAnnotations.DisplayFormatAttribute> to customize formatting for a data field. The example performs the following steps:
The following example shows how to use the <xref:System.ComponentModel.DataAnnotations.DisplayFormatAttribute> to customize formatting for a data field. The example performs the following steps:

- Implements a metadata partial class and an associated metadata class.

- In the associated metadata class, it applies the <xref:System.ComponentModel.DataAnnotations.DisplayFormatAttribute> attribute to specify the following results:

- Display the text "[Null]" when a data field is empty.

- Display currency data in locale specific currency format.

- Display date information in short format (mm/dd/yy). This format also applies in edit mode.

:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.ComponentModel.DataAnnotations.DisplayFormatAttribute/CS/product.cs" id="Snippet1":::
Expand All @@ -72,9 +69,7 @@
To compile the example, you need the following:

- Any edition of Visual Studio 2010 or later.

- The AdventureWorksLT sample database. For information about how to download and install the SQL Server sample database, see [Microsoft SQL Server Product Samples: Database](https://github.com/Microsoft/sql-server-samples/releases) on GitHub. Make sure that you install the correct version of the sample database for the version of SQL Server that you are running.

- A data-driven Web site. This enables you to create a data context for the database and the class that contains the data field to customize. For more information, see `Walkthrough: Creating a New Dynamic Data Web Site using Scaffolding`.

]]></format>
Expand Down
6 changes: 0 additions & 6 deletions xml/System.Web.DynamicData/DynamicControl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@
</asp:DynamicControl>
```
## Examples
See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.DynamicControl).
The following example demonstrates how to use the <xref:System.Web.DynamicData.DynamicControl> control in a <xref:System.Web.UI.WebControls.ListView> control to display, insert, delete and edit values from a database table. It is important to notice that in order to make the insert operation to work, the <xref:System.Data.Linq.Mapping.ColumnAttribute.IsDbGenerated%2A> property of the `rowguid` and `ModifiedDate` columns are set to `true`.
Expand Down Expand Up @@ -844,10 +841,7 @@
The field template that you specify using the <xref:System.Web.DynamicData.DynamicControl.UIHint%2A> property is specific to this instance of the <xref:System.Web.DynamicData.DynamicControl> control. You can also change the field template used by a data field across the entire application by applying the <xref:System.ComponentModel.DataAnnotations.UIHintAttribute> to your data model. Setting the <xref:System.Web.DynamicData.DynamicControl.UIHint%2A> property overrides the metadata applied to the data model. For more information about metadata attributes, see [ASP.NET Dynamic Data](https://msdn.microsoft.com/library/78c7fcd7-5f38-46a0-a4bc-48eff3c8a512).
## Examples
See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.DynamicControl.UIHint).
The following example shows how you can specify a data field to use a different field template to render its contents. The second example shows the custom field template specified by the <xref:System.Web.DynamicData.DynamicControl.UIHint%2A> property.
Expand Down
3 changes: 0 additions & 3 deletions xml/System.Web.DynamicData/DynamicField.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,7 @@
<asp:DynamicField />
```



## Examples
See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.DynamicField).

The following example demonstrates how to use the <xref:System.Web.DynamicData.DynamicField> object in a <xref:System.Web.UI.WebControls.GridView> control to display and edit values from a database table.

Expand Down
4 changes: 0 additions & 4 deletions xml/System.Web.DynamicData/DynamicQueryStringParameter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@

In order to use the <xref:System.Web.DynamicData.DynamicQueryStringParameter> class, you must add a <xref:System.Web.DynamicData.DynamicDataManager> control to the page and you must register the data-bound control with the <xref:System.Web.DynamicData.DynamicDataManager> control by using the <xref:System.Web.DynamicData.DynamicDataManager.RegisterControl%2A?displayProperty=nameWithType> method.

See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.DynamicQueryStringParameter).



## Examples
The following example shows how to use the <xref:System.Web.DynamicData.DynamicQueryStringParameter> object as filter when displaying data in a <xref:System.Web.UI.WebControls.GridView> control. The <xref:System.Web.UI.WebControls.GridView> control contains a <xref:System.Web.UI.WebControls.TemplateField> object that creates a link that sets the query string value by using the foreign key value.

Expand Down
23 changes: 0 additions & 23 deletions xml/System.Web.DynamicData/MetaModel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@

In Visual Studio, you can generate data-model types by using the **LINQ to SQL Classes** template or the **ADO.NET Entity Data Model** template. These templates use the Object Relational Designer (O/R Designer) for the LINQ to SQL model, or the ADO.NET Entity Data Model Designer (Entity Designer) for the Entity Framework model.



## Examples
The following example shows how to use <xref:System.Web.DynamicData.MetaModel> type to perform the following tasks in order to use automatic scaffolding in an ASP.NET Web site:

- Get the data model for the default data context.

- Get the data model for a specified data context.

- Evaluate the routing path (determine the URL) for a specified table.

The example consists of a page and its code-behind file.
Expand All @@ -50,11 +46,8 @@
To compile the example, you need the following:

- Visual Studio 2010 or Visual Web Developer 2010 Express.

- A Dynamic Data Web site. For more information, see [Walkthrough: Creating a New Dynamic Data Web Site Using Scaffolding](https://msdn.microsoft.com/library/1564aef2-9103-436a-9806-c8ad7abd616a).

See a run-time code example of this feature: [Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.MetaModel).

]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">Can be thrown by any method if there has been a data context registration error.</exception>
Expand Down Expand Up @@ -362,10 +355,6 @@
## Remarks
The route is determined by the combination of the table name and action.

[Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.MetaModel&spage=PathModel.aspx) an online example of this feature.



## Examples
The following example shows how to use the <xref:System.Web.DynamicData.MetaModel.GetActionPath%28System.String%2CSystem.String%2CSystem.Object%29> method to evaluate the routing path (determine the URL) for a specified table. For a complete example, see <xref:System.Web.DynamicData.MetaModel>.

Expand Down Expand Up @@ -432,15 +421,10 @@
## Remarks
The <xref:System.Web.DynamicData.MetaTable> object that is returned by the overloaded methods contains the metadata information that is associated with the specified table.

[Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.MetaModel&spage=GetTable.aspx) an online example of this feature.



## Examples
The following example shows how to use the <xref:System.Web.DynamicData.MetaModel.GetTable%2A> overloaded methods to perform the following tasks:

- Get the <xref:System.Web.DynamicData.MetaTable> object for the specified table.

- Access the metadata information that is contained by the <xref:System.Web.DynamicData.MetaTable> object.

The example consists of a page and its code-behind file.
Expand Down Expand Up @@ -485,8 +469,6 @@
## Remarks
The name uniquely identifies a table in the data model and is used to generate the related URL for routing.



## Examples
The following example shows how to use the <xref:System.Web.DynamicData.MetaModel.GetTable%28System.String%29> method to obtain the metadata for the specified table. For a complete example, see <xref:System.Web.DynamicData.MetaModel.GetTable%2A>.

Expand Down Expand Up @@ -866,15 +848,10 @@
## Remarks
The collection contains all the tables in the data model, which includes the tables that are not visible (are not part of Dynamic Data scaffolding).

[Run](https://go.microsoft.com/fwlink/?LinkId=120736&sref=System.Web.DynamicData.MetaModel&spage=TablesMenu.aspx) an online example of this feature.



## Examples
The following example shows how to use the <xref:System.Web.DynamicData.MetaModel.Tables%2A> and <xref:System.Web.DynamicData.MetaModel.VisibleTables%2A> properties to perform the following tasks:

- Get a collection of all the tables in a data model and show them in a `GridView` control.

- Get a collection of the visible tables in a data model and show them in a `GridView` control.

The example consists of a page and its code-behind file.
Expand Down