|
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
|
Übersetzung
Original
|
DetailsView-Klasse
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
[ControlValuePropertyAttribute("SelectedValue")] public class DetailsView : CompositeDataBoundControl, IDataItemContainer, INamingContainer, ICallbackContainer, ICallbackEventHandler, IPostBackEventHandler, IPostBackContainer, IDataBoundItemControl, IDataBoundControl, IFieldControl
<asp:DetailsView />
Der DetailsView-Typ macht die folgenden Member verfügbar.
| Name | Beschreibung | |
|---|---|---|
![]() | AccessKey | |
![]() | Adapter | |
![]() | AllowPaging | |
![]() | AlternatingRowStyle | |
![]() | AppRelativeTemplateSourceDirectory | |
![]() | Attributes | |
![]() | AutoGenerateDeleteButton | |
![]() | AutoGenerateEditButton | |
![]() | AutoGenerateInsertButton | |
![]() | AutoGenerateRows | |
![]() | BackColor | |
![]() | BackImageUrl | |
![]() | BindingContainer | Infrastruktur. |
![]() | BorderColor | |
![]() | BorderStyle | |
![]() | BorderWidth | |
![]() | BottomPagerRow | |
![]() | Caption | |
![]() | CaptionAlign | |
![]() | CellPadding | |
![]() | CellSpacing | |
![]() | ChildControlsCreated | |
![]() | ClientID | |
![]() | ClientIDMode | |
![]() | ClientIDSeparator | |
![]() | CommandRowStyle | |
![]() | Context | |
![]() | Controls | |
![]() | ControlStyle | |
![]() | ControlStyleCreated | |
![]() | CssClass | |
![]() | CurrentMode | |
![]() | DataItem | |
![]() | DataItemContainer | |
![]() | DataItemCount | |
![]() | DataItemIndex | |
![]() | DataKey | |
![]() | DataKeyNames | |
![]() | DataKeysContainer | |
![]() | DataMember | |
![]() | DataSource | |
![]() | DataSourceID | |
![]() | DataSourceObject | |
![]() | DefaultMode | |
![]() | DeleteMethod | |
![]() | DesignMode | |
![]() | EditRowStyle | |
![]() | EmptyDataRowStyle | |
![]() | EmptyDataTemplate | |
![]() | EmptyDataText | |
![]() | Enabled | |
![]() | EnableModelValidation | |
![]() | EnablePagingCallbacks | |
![]() | EnableTheming | |
![]() | EnableViewState | |
![]() | Events | |
![]() | FieldHeaderStyle | |
![]() | Fields | |
![]() | Font | |
![]() | FooterRow | |
![]() | FooterStyle | |
![]() | FooterTemplate | |
![]() | FooterText | |
![]() | ForeColor | |
![]() | GridLines | |
![]() | HasAttributes | |
![]() | HasChildViewState | |
![]() | HeaderRow | |
![]() | HeaderStyle | |
![]() | HeaderTemplate | |
![]() | HeaderText | |
![]() | Height | |
![]() | HorizontalAlign | |
![]() | ID | |
![]() | IdSeparator | Infrastruktur. |
![]() | Initialized | |
![]() | InsertMethod | |
![]() | InsertRowStyle | |
![]() | IsBoundUsingDataSourceID | |
![]() | IsChildControlStateCleared | |
![]() | IsDataBindingAutomatic | |
![]() | IsEnabled | |
![]() | IsTrackingViewState | |
![]() | IsUsingModelBinders | |
![]() | IsViewStateEnabled | |
![]() | ItemType | |
![]() | LoadViewStateByID | |
![]() | NamingContainer | |
![]() | Page | |
![]() | PageCount | |
![]() | PageIndex | |
![]() | PagerSettings | |
![]() | PagerStyle | |
![]() | PagerTemplate | |
![]() | Parent | |
![]() | RenderingCompatibility | |
![]() | RequiresDataBinding | |
![]() | Rows | |
![]() | RowsGenerator | |
![]() | RowStyle | |
![]() | SelectArguments | |
![]() | SelectedValue | |
![]() | SelectMethod | |
![]() | Site | |
![]() | SkinID | |
![]() | Style | |
![]() | SupportsDisabledAttribute | |
![]() | TabIndex | |
![]() | TagKey | |
![]() | TagName | |
![]() | TemplateControl | |
![]() | TemplateSourceDirectory | |
![]() | ToolTip | |
![]() | TopPagerRow | |
![]() | UniqueID | |
![]() | UpdateMethod | |
![]() | ValidateRequestMode | |
![]() | ViewState | |
![]() | ViewStateIgnoresCase | |
![]() | ViewStateMode | |
![]() | Visible | |
![]() | Width |
| Name | Beschreibung | |
|---|---|---|
![]() | AddAttributesToRender | |
![]() | AddedControl | |
![]() | AddParsedSubObject | |
![]() | ApplyStyle | |
![]() | ApplyStyleSheetSkin | |
![]() | BeginRenderTracing | |
![]() | BuildProfileTree | Infrastruktur. |
![]() | ChangeMode | |
![]() | ClearCachedClientID | Infrastruktur. |
![]() | ClearChildControlState | |
![]() | ClearChildState | |
![]() | ClearChildViewState | |
![]() | ClearEffectiveClientIDMode | Infrastruktur. |
![]() | ConfirmInitState | |
![]() | CopyBaseAttributes | |
![]() | CreateAutoGeneratedRow | |
![]() | CreateAutoGeneratedRows | |
![]() | CreateChildControls() | Infrastruktur. |
![]() | CreateChildControls(IEnumerable, Boolean) | |
![]() | CreateControlCollection | |
![]() | CreateControlStyle | |
![]() | CreateDataSourceSelectArguments | Infrastruktur. |
![]() | CreateFieldSet | |
![]() | CreateRow | |
![]() | CreateTable | |
![]() | DataBind() | Infrastruktur. |
![]() | DataBind(Boolean) | |
![]() | DataBindChildren | |
![]() | DeleteItem | |
![]() | Dispose | |
![]() | EndRenderTracing | |
![]() | EnsureChildControls | |
![]() | EnsureDataBound | Infrastruktur. |
![]() | EnsureID | |
![]() | Equals(Object) | |
![]() | ExtractRowValues | |
![]() | Finalize | |
![]() | FindControl(String) | |
![]() | FindControl(String, Int32) | Infrastruktur. |
![]() | Focus | |
![]() | GetCallbackResult | |
![]() | GetCallbackScript | Infrastruktur. |
![]() | GetData | |
![]() | GetDataSource | |
![]() | GetDesignModeState | Infrastruktur. |
![]() | GetHashCode | |
![]() | GetRouteUrl(Object) | |
![]() | GetRouteUrl(RouteValueDictionary) | |
![]() | GetRouteUrl(String, Object) | |
![]() | GetRouteUrl(String, RouteValueDictionary) | |
![]() | GetType | |
![]() | GetUniqueIDRelativeTo | |
![]() | HasControls | |
![]() | HasEvents | |
![]() | InitializePager | |
![]() | InitializeRow | |
![]() | InsertItem | |
![]() | IsBindableType | |
![]() | IsLiteralContent | Infrastruktur. |
![]() | LoadControlState | |
![]() | LoadViewState | |
![]() | MapPathSecure | |
![]() | MarkAsDataBound | |
![]() | MemberwiseClone | |
![]() | MergeStyle | |
![]() | OnBubbleEvent | |
![]() | OnCreatingModelDataSource | |
![]() | OnDataBinding | |
![]() | OnDataBound | |
![]() | OnDataPropertyChanged | |
![]() | OnDataSourceViewChanged | Infrastruktur. |
![]() | OnInit | |
![]() | OnItemCommand | |
![]() | OnItemCreated | |
![]() | OnItemDeleted | |
![]() | OnItemDeleting | |
![]() | OnItemInserted | |
![]() | OnItemInserting | |
![]() | OnItemUpdated | |
![]() | OnItemUpdating | |
![]() | OnLoad | |
![]() | OnModeChanged | |
![]() | OnModeChanging | |
![]() | OnPageIndexChanged | |
![]() | OnPageIndexChanging | |
![]() | OnPagePreLoad | |
![]() | OnPreRender | |
![]() | OnUnload | |
![]() | OpenFile | |
![]() | PerformDataBinding | Infrastruktur. |
![]() | PerformSelect | |
![]() | PrepareControlHierarchy | Infrastruktur. |
![]() | RaiseBubbleEvent | |
![]() | RaiseCallbackEvent | |
![]() | RaisePostBackEvent | |
![]() | RemovedControl | |
![]() | Render | Infrastruktur. |
![]() | RenderBeginTag | |
![]() | RenderChildren | |
![]() | RenderContents | |
![]() | RenderControl(HtmlTextWriter) | |
![]() | RenderControl(HtmlTextWriter, ControlAdapter) | |
![]() | RenderEndTag | |
![]() | ResolveAdapter | |
![]() | ResolveClientUrl | |
![]() | ResolveUrl | |
![]() | SaveControlState | Infrastruktur. |
![]() | SaveViewState | Infrastruktur. |
![]() | SetDesignModeState | |
![]() | SetPageIndex | |
![]() | SetRenderMethodDelegate | Infrastruktur. |
![]() | SetTraceData(Object, Object) | |
![]() | SetTraceData(Object, Object, Object) | |
![]() | ToString | |
![]() | TrackViewState | Infrastruktur. |
![]() | UpdateItem | |
![]() | ValidateDataSource |
| Name | Beschreibung | |
|---|---|---|
![]() | CallingDataMethods | |
![]() | CreatingModelDataSource | |
![]() | DataBinding | |
![]() | DataBound | |
![]() | Disposed | |
![]() | Init | |
![]() | ItemCommand | |
![]() | ItemCreated | |
![]() | ItemDeleted | |
![]() | ItemDeleting | |
![]() | ItemInserted | |
![]() | ItemInserting | |
![]() | ItemUpdated | |
![]() | ItemUpdating | |
![]() | Load | |
![]() | ModeChanged | |
![]() | ModeChanging | |
![]() | PageIndexChanged | |
![]() | PageIndexChanging | |
![]() | PreRender | |
![]() | Unload |
| Name | Beschreibung | |
|---|---|---|
![]() | EnableDynamicData(Type) | Überladen. |
![]() | EnableDynamicData(Type, Object) | Überladen. |
![]() | EnableDynamicData(Type, IDictionary<String, Object>) | Überladen. |
![]() | EnablePersistedSelection | |
![]() | FindDataSourceControl | |
![]() | FindFieldTemplate | |
![]() | FindMetaTable | |
![]() | GetDefaultValues | |
![]() | GetMetaTable | |
![]() | SetMetaTable(MetaTable) | Überladen. |
![]() | SetMetaTable(MetaTable, IDictionary<String, Object>) | Überladen. |
![]() | SetMetaTable(MetaTable, Object) | Überladen. |
![]() | TryGetMetaTable |
| Name | Beschreibung | |
|---|---|---|
![]() ![]() | IAttributeAccessor.GetAttribute | Infrastruktur. |
![]() ![]() | IAttributeAccessor.SetAttribute | |
![]() ![]() | ICallbackContainer.GetCallbackScript | Infrastruktur. |
![]() ![]() | ICallbackEventHandler.GetCallbackResult | Infrastruktur. |
![]() ![]() | ICallbackEventHandler.RaiseCallbackEvent | Infrastruktur. |
![]() ![]() | IControlBuilderAccessor.ControlBuilder | |
![]() ![]() | IControlDesignerAccessor.GetDesignModeState | |
![]() ![]() | IControlDesignerAccessor.SetDesignModeState | |
![]() ![]() | IControlDesignerAccessor.SetOwnerControl | Infrastruktur. |
![]() ![]() | IControlDesignerAccessor.UserData | |
![]() ![]() | IDataBindingsAccessor.DataBindings | |
![]() ![]() | IDataBindingsAccessor.HasDataBindings | |
![]() ![]() | IDataBoundControl.DataKeyNames | |
![]() ![]() | IDataBoundControl.DataMember | |
![]() ![]() | IDataBoundControl.DataSource | |
![]() ![]() | IDataBoundControl.DataSourceID | |
![]() ![]() | IDataBoundControl.DataSourceObject | |
![]() ![]() | IDataBoundItemControl.DataKey | |
![]() ![]() | IDataBoundItemControl.Mode | |
![]() ![]() | IDataItemContainer.DataItemIndex | Infrastruktur. |
![]() ![]() | IDataItemContainer.DisplayIndex | Infrastruktur. |
![]() ![]() | IExpressionsAccessor.Expressions | |
![]() ![]() | IExpressionsAccessor.HasExpressions | |
![]() ![]() | IFieldControl.FieldsGenerator | |
![]() ![]() | IParserAccessor.AddParsedSubObject | |
![]() ![]() | IPostBackContainer.GetPostBackOptions | Infrastruktur. |
![]() ![]() | IPostBackEventHandler.RaisePostBackEvent | Infrastruktur. |
Einführung
Die Bindung an Datenquellensteuerelemente (z. B. SqlDataSource). Integrierte Einfügefunktionen. Integrierte Aktualisierungsfunktionen und Löschfunktionen. Integrierte Pagingfunktionen. Programmgesteuerter Zugriff auf das DetailsView-Objektmodell zum dynamischen Festlegen von Eigenschaften, Behandeln von Ereignissen usw. Anpassbare Darstellung durch Designs und Stile.
Zeilenfelder
Hinweis |
|---|
Hinweis |
|---|
Binden an Daten
Für die Bindung an ein Datenquellen-Steuerelement legen Sie die DataSourceID-Eigenschaft des DetailsView-Steuerelements auf den ID-Wert des Datenquellen-Steuerelements fest. Das DetailsView-Steuerelement wird automatisch an das angegebene Datenquellen-Steuerelement gebunden. Dies ist die bevorzugte Methode für die Bindung an Daten. Zum Binden an eine Datenquelle, die die System.Collections.IEnumerable-Schnittstelle implementiert, legen Sie die DataSource-Eigenschaft des DetailsView-Steuerelements programmgesteuert auf die Datenquelle fest, und rufen Sie anschließend die DataBind-Methode auf.
Sicherheit
Datenoperationen
Hinweis |
|---|
Hinweis |
|---|
Anpassen der Benutzeroberfläche
Ereignisse
Barrierefreiheit
Deklarative Syntax
<asp:DetailsView
AccessKey="string"
AllowPaging="True|False"
AutoGenerateDeleteButton="True|False"
AutoGenerateEditButton="True|False"
AutoGenerateInsertButton="True|False"
AutoGenerateRows="True|False"
BackColor="color name|#dddddd"
BackImageUrl="uri"
BorderColor="color name|#dddddd"
BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
Inset|Outset"
BorderWidth="size"
Caption="string"
CaptionAlign="NotSet|Top|Bottom|Left|Right"
CellPadding="integer"
CellSpacing="integer"
CssClass="string"
DataKeyNames="string"
DataMember="string"
DataSource="string"
DataSourceID="string"
DefaultMode="ReadOnly|Edit|Insert"
EmptyDataText="string"
Enabled="True|False"
EnablePagingCallbacks="True|False"
EnableTheming="True|False"
EnableViewState="True|False"
Font-Bold="True|False"
Font-Italic="True|False"
Font-Names="string"
Font-Overline="True|False"
Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
Large|X-Large|XX-Large"
Font-Strikeout="True|False"
Font-Underline="True|False"
FooterText="string"
ForeColor="color name|#dddddd"
GridLines="None|Horizontal|Vertical|Both"
HeaderText="string"
Height="size"
HorizontalAlign="NotSet|Left|Center|Right|Justify"
ID="string"
OnDataBinding="DataBinding event handler"
OnDataBound="DataBound event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnItemCommand="ItemCommand event handler"
OnItemCreated="ItemCreated event handler"
OnItemDeleted="ItemDeleted event handler"
OnItemDeleting="ItemDeleting event handler"
OnItemInserted="ItemInserted event handler"
OnItemInserting="ItemInserting event handler"
OnItemUpdated="ItemUpdated event handler"
OnItemUpdating="ItemUpdating event handler"
OnLoad="Load event handler"
OnModeChanged="ModeChanged event handler"
OnModeChanging="ModeChanging event handler"
OnPageIndexChanged="PageIndexChanged event handler"
OnPageIndexChanging="PageIndexChanging event handler"
OnPreRender="PreRender event handler"
OnUnload="Unload event handler"
PageIndex="integer"
PagerSettings-FirstPageImageUrl="uri"
PagerSettings-FirstPageText="string"
PagerSettings-LastPageImageUrl="uri"
PagerSettings-LastPageText="string"
PagerSettings-Mode="NextPrevious|Numeric|NextPreviousFirstLast|NumericFirstLast"
PagerSettings-NextPageImageUrl="uri"
PagerSettings-NextPageText="string"
PagerSettings-PageButtonCount="integer"
PagerSettings-Position="Bottom|Top|TopAndBottom"
PagerSettings-PreviousPageImageUrl="uri"
PagerSettings-PreviousPageText="string"
PagerSettings-Visible="True|False"
runat="server"
SkinID="string"
Style="string"
TabIndex="integer"
ToolTip="string"
Visible="True|False"
Width="size"
>
<AlternatingRowStyle />
<CommandRowStyle />
<EditRowStyle />
<EmptyDataRowStyle />
<EmptyDataTemplate>
<!-- child controls -->
</EmptyDataTemplate>
<FieldHeaderStyle />
<Fields>
<asp:BoundField
AccessibleHeaderText="string"
ApplyFormatInEditMode="True|False"
ConvertEmptyStringToNull="True|False"
DataField="string"
DataFormatString="string"
FooterText="string"
HeaderImageUrl="uri"
HeaderText="string"
HtmlEncode="True|False"
InsertVisible="True|False"
NullDisplayText="string"
ReadOnly="True|False"
ShowHeader="True|False"
SortExpression="string"
Visible="True|False"
>
<ControlStyle />
<FooterStyle />
<HeaderStyle />
<ItemStyle />
</asp:BoundField>
<asp:ButtonField
AccessibleHeaderText="string"
ButtonType="Button|Image|Link"
CausesValidation="True|False"
CommandName="string"
DataTextField="string"
DataTextFormatString="string"
FooterText="string"
HeaderImageUrl="uri"
HeaderText="string"
ImageUrl="uri"
InsertVisible="True|False"
ShowHeader="True|False"
SortExpression="string"
Text="string"
ValidationGroup="string"
Visible="True|False"
>
<ControlStyle />
<FooterStyle />
<HeaderStyle />
<ItemStyle />
</asp:ButtonField>
<asp:CheckBoxField
AccessibleHeaderText="string"
DataField="string"
FooterText="string"
HeaderImageUrl="uri"
HeaderText="string"
InsertVisible="True|False"
ReadOnly="True|False"
ShowHeader="True|False"
SortExpression="string"
Text="string"
Visible="True|False"
>
<ControlStyle />
<FooterStyle />
<HeaderStyle />
<ItemStyle />
</asp:CheckBoxField>
<asp:CommandField
AccessibleHeaderText="string"
ButtonType="Button|Image|Link"
CancelImageUrl="uri"
CancelText="string"
CausesValidation="True|False"
DeleteImageUrl="uri"
DeleteText="string"
EditImageUrl="uri"
EditText="string"
FooterText="string"
HeaderImageUrl="uri"
HeaderText="string"
InsertImageUrl="uri"
InsertText="string"
InsertVisible="True|False"
NewImageUrl="uri"
NewText="string"
SelectImageUrl="uri"
SelectText="string"
ShowCancelButton="True|False"
ShowDeleteButton="True|False"
ShowEditButton="True|False"
ShowHeader="True|False"
ShowInsertButton="True|False"
ShowSelectButton="True|False"
SortExpression="string"
UpdateImageUrl="uri"
UpdateText="string"
ValidationGroup="string"
Visible="True|False"
>
<ControlStyle />
<FooterStyle />
<HeaderStyle />
<ItemStyle />
</asp:CommandField>
<asp:DynamicField
AccessibleHeaderText="string"
ApplyFormatInEditMode="True|False"
ConvertEmptyStringToNull="True|False"
DataField="string"
DataFormatString="string"
FooterText="string"
HeaderImageUrl="uri"
HeaderText="string"
HtmlEncode="True|False"
InsertVisible="True|False"
NullDisplayText="string"
ShowHeader="True|False"
UIHint="string"
Visible="True|False"
>
<ControlStyle />
<FooterStyle />
<HeaderStyle />
<ItemStyle />
</asp:DynamicField>
<asp:HyperLinkField
AccessibleHeaderText="string"
DataNavigateUrlFields="string"
DataNavigateUrlFormatString="string"
DataTextField="string"
DataTextFormatString="string"
FooterText="string"
HeaderImageUrl="uri"
HeaderText="string"
InsertVisible="True|False"
NavigateUrl="uri"
ShowHeader="True|False"
SortExpression="string"
Target="string|_blank|_parent|_search|_self|_top"
Text="string"
Visible="True|False"
>
<ControlStyle />
<FooterStyle />
<HeaderStyle />
<ItemStyle />
</asp:HyperLinkField>
<asp:ImageField
AccessibleHeaderText="string"
AlternateText="string"
ConvertEmptyStringToNull="True|False"
DataAlternateTextField="string"
DataAlternateTextFormatString="string"
DataImageUrlField="string"
DataImageUrlFormatString="string"
FooterText="string"
HeaderImageUrl="uri"
HeaderText="string"
InsertVisible="True|False"
NullDisplayText="string"
NullImageUrl="uri"
ReadOnly="True|False"
ShowHeader="True|False"
SortExpression="string"
Visible="True|False"
>
<ControlStyle />
<FooterStyle />
<HeaderStyle />
<ItemStyle />
</asp:ImageField>
<asp:TemplateField
AccessibleHeaderText="string"
ConvertEmptyStringToNull="True|False"
FooterText="string"
HeaderImageUrl="uri"
HeaderText="string"
InsertVisible="True|False"
ShowHeader="True|False"
SortExpression="string"
Visible="True|False"
>
<ControlStyle />
<FooterStyle />
<HeaderStyle />
<ItemStyle />
<AlternatingItemTemplate>
<!-- child controls -->
</AlternatingItemTemplate>
<EditItemTemplate>
<!-- child controls -->
</EditItemTemplate>
<FooterTemplate>
<!-- child controls -->
</FooterTemplate>
<HeaderTemplate>
<!-- child controls -->
</HeaderTemplate>
<InsertItemTemplate>
<!-- child controls -->
</InsertItemTemplate>
<ItemTemplate>
<!-- child controls -->
</ItemTemplate>
</asp:TemplateField>
</Fields>
<FooterStyle />
<FooterTemplate>
<!-- child controls -->
</FooterTemplate>
<HeaderStyle />
<HeaderTemplate>
<!-- child controls -->
</HeaderTemplate>
<InsertRowStyle />
<PagerSettings
FirstPageImageUrl="uri"
FirstPageText="string"
LastPageImageUrl="uri"
LastPageText="string"
Mode="NextPrevious|Numeric|NextPreviousFirstLast|
NumericFirstLast"
NextPageImageUrl="uri"
NextPageText="string"
OnPropertyChanged="PropertyChanged event handler"
PageButtonCount="integer"
Position="Bottom|Top|TopAndBottom"
PreviousPageImageUrl="uri"
PreviousPageText="string"
Visible="True|False"
/>
<PagerStyle />
<PagerTemplate>
<!-- child controls -->
</PagerTemplate>
<RowStyle />
</asp:DetailsView>
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</title> </head> <body> <form id="form1" runat="server"> <div> <table> <tr> <td> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="Customers" DataKeyNames="CustomerID"> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="ContactName" HeaderText="ContactName" /> <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" /> </Columns> </asp:GridView> </td> <td valign="top"> <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="True" DataKeyNames="CustomerID" DataSourceID="Details" Height="50px" Width="301px"> </asp:DetailsView> </td> </tr> </table> <asp:SqlDataSource ID="Details" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT * FROM [Customers] WHERE ([CustomerID] = @CustomerID)"> <SelectParameters> <asp:ControlParameter ControlID="GridView1" Name="CustomerID" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="Customers" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] FROM [Customers]"> </asp:SqlDataSource> </div> </form> </body> </html>
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> void CustomerDetail_ItemInserted(object sender, DetailsViewInsertedEventArgs e) { // Refresh the GridView control after a new record is inserted // in the DetailsView control. CustomersView.DataBind(); } void CustomerDetail_ItemInserting(object sender, DetailsViewInsertEventArgs e) { // Iterate though the values entered by the user and HTML encode // the values. This helps prevent malicious values from being // stored in the data source. for (int i = 0; i < e.Values.Count; i++) { if (e.Values[i] != null) { e.Values[i] = Server.HtmlEncode(e.Values[i].ToString()); } } } void CustomerDetail_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e) { // Refresh the GridView control after a new record is updated // in the DetailsView control. CustomersView.DataBind(); } void CustomerDetail_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { // Iterate though the values entered by the user and HTML encode // the values. This helps prevent malicious values from being // stored in the data source. for (int i = 0; i < e.NewValues.Count; i++) { if (e.NewValues[i] != null) { e.NewValues[i] = Server.HtmlEncode(e.NewValues[i].ToString()); } } } void CustomerDetail_ItemDeleted(object sender, DetailsViewDeletedEventArgs e) { // Refresh the GridView control after a new record is updated // in the DetailsView control. CustomersView.DataBind(); } </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title> DetailsView Example</title> </head> <body> <form id="Form1" runat="server"> <h3> DetailsView Example</h3> <table cellspacing="10"> <tr> <td> <!-- Use a GridView control in combination with --> <!-- a DetailsView control to display master-detail --> <!-- information. When the user selects a store from --> <!-- GridView control, the customers//s detailed --> <!-- information is displayed in the DetailsView --> <!-- control. --> <asp:GridView ID="CustomersView" DataSourceID="Customers" AutoGenerateColumns="False" DataKeyNames="CustomerID" runat="server"> <HeaderStyle BackColor="Blue" ForeColor="White" /> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="ContactName" HeaderText="ContactName" /> <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" /> </Columns> </asp:GridView> </td> <td valign="top"> <asp:DetailsView ID="CustomerDetail" DataSourceID="Details" AutoGenerateRows="false" AutoGenerateInsertButton="true" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" EmptyDataText="No records." DataKeyNames="CustomerID" GridLines="Both" OnItemInserted="CustomerDetail_ItemInserted" OnItemInserting="CustomerDetail_ItemInserting" OnItemUpdated="CustomerDetail_ItemUpdated" OnItemUpdating="CustomerDetail_ItemUpdating" OnItemDeleted="CustomerDetail_ItemDeleted" runat="server"> <HeaderStyle BackColor="Navy" ForeColor="White" /> <RowStyle BackColor="White" /> <AlternatingRowStyle BackColor="LightGray" /> <EditRowStyle BackColor="LightCyan" /> <Fields> <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" /> <asp:BoundField DataField="ContactName" HeaderText="ContactName" /> <asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" /> <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" /> <asp:BoundField DataField="Address" HeaderText="Address" /> <asp:BoundField DataField="City" HeaderText="City" /> <asp:BoundField DataField="Region" HeaderText="Region" /> <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" /> <asp:BoundField DataField="Country" HeaderText="Country" /> <asp:BoundField DataField="Phone" HeaderText="Phone" /> <asp:BoundField DataField="Fax" HeaderText="Fax" /> </Fields> </asp:DetailsView> </td> </tr> </table> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. --> <!-- It is strongly recommended that each data-bound --> <!-- control uses a separate data source control. --> <asp:SqlDataSource ID="Customers" runat="server" ConnectionString= "<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] FROM [Customers]"> </asp:SqlDataSource> <!-- Add a filter to the data source control for the --> <!-- DetailsView control to display the details of the --> <!-- store selected in the GridView control. --> <asp:SqlDataSource ID="Details" ConnectionString= "<%$ ConnectionStrings:NorthwindConnectionString %>" runat="server" SelectCommand="SELECT * FROM [Customers] WHERE ([CustomerID] = @CustomerID)" DeleteCommand="DELETE FROM [Customers] WHERE [CustomerID] = @CustomerID" InsertCommand="INSERT INTO [Customers] ([CustomerID], [CompanyName], [ContactName], [ContactTitle], [Address], [City], [Region], [PostalCode], [Country], [Phone], [Fax]) VALUES (@CustomerID, @CompanyName, @ContactName, @ContactTitle, @Address, @City, @Region, @PostalCode, @Country, @Phone, @Fax)" UpdateCommand="UPDATE [Customers] SET [CompanyName] = @CompanyName, [ContactName] = @ContactName, [ContactTitle] = @ContactTitle, [Address] = @Address, [City] = @City, [Region] = @Region, [PostalCode] = @PostalCode, [Country] = @Country, [Phone] = @Phone, [Fax] = @Fax WHERE [CustomerID] = @CustomerID"> <SelectParameters> <asp:ControlParameter ControlID="CustomersView" Name="CustomerID" PropertyName="SelectedValue" Type="String" /> </SelectParameters> <DeleteParameters> <asp:Parameter Name="CustomerID" Type="String" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="CompanyName" Type="String" /> <asp:Parameter Name="ContactName" Type="String" /> <asp:Parameter Name="ContactTitle" Type="String" /> <asp:Parameter Name="Address" Type="String" /> <asp:Parameter Name="City" Type="String" /> <asp:Parameter Name="Region" Type="String" /> <asp:Parameter Name="PostalCode" Type="String" /> <asp:Parameter Name="Country" Type="String" /> <asp:Parameter Name="Phone" Type="String" /> <asp:Parameter Name="Fax" Type="String" /> <asp:Parameter Name="CustomerID" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="CustomerID" Type="String" /> <asp:Parameter Name="CompanyName" Type="String" /> <asp:Parameter Name="ContactName" Type="String" /> <asp:Parameter Name="ContactTitle" Type="String" /> <asp:Parameter Name="Address" Type="String" /> <asp:Parameter Name="City" Type="String" /> <asp:Parameter Name="Region" Type="String" /> <asp:Parameter Name="PostalCode" Type="String" /> <asp:Parameter Name="Country" Type="String" /> <asp:Parameter Name="Phone" Type="String" /> <asp:Parameter Name="Fax" Type="String" /> </InsertParameters> </asp:SqlDataSource> </form> </body> </html>
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</title> </head> <body> <form id="Form1" runat="server"> <table cellspacing="10"> <tr> <td> <!-- Use a GridView control in combination with --> <!-- a DetailsView control to display master-detail --> <!-- information. When the user selects a store from --> <!-- GridView control, the store's detailed --> <!-- information is displayed in the DetailsView --> <!-- control. --> <asp:GridView ID="GridView1" runat="server" DataSourceID="Customers" AutoGenerateColumns="False" DataKeyNames="CustomerID"> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="ContactName" HeaderText="ContactName" /> <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" /> </Columns> </asp:GridView> </td> <td valign="top"> <asp:DetailsView ID="DetailsView" runat="server" DataSourceID="Details" AutoGenerateRows="false" DataKeyNames="CustomerID" > <HeaderStyle BackColor="Navy" ForeColor="White" /> <Fields> <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" /> <asp:BoundField DataField="ContactName" HeaderText="ContactName" /> <asp:BoundField DataField="ContactTitle" HeaderText="ContactTitle" /> <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" /> <asp:BoundField DataField="City" HeaderText="City" /> <asp:BoundField DataField="Region" HeaderText="Region" /> <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" /> <asp:BoundField DataField="Country" HeaderText="Country" /> </Fields> </asp:DetailsView> </td> </tr> </table> <!-- This example uses Microsoft SQL Server and connects --> <!-- to the Northwind sample database. --> <!-- It is strongly recommended that each data-bound --> <!-- control uses a separate data source control. --> <asp:SqlDataSource ID="Customers" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT [CompanyName], [ContactName], [CustomerID] FROM [Customers]"> </asp:SqlDataSource> <!-- Add a filter to the data source control for the --> <!-- DetailsView control to display the details of the --> <!-- store selected in the GridView control. --> <asp:SqlDataSource ID="Details" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT * FROM [Customers] WHERE ([CustomerID] = @CustomerID)"> <SelectParameters> <asp:ControlParameter ControlID="GridView1" Name="CustomerID" PropertyName="SelectedValue" Type="String" /> </SelectParameters> </asp:SqlDataSource> </form> </body> </html>
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core-Rolle wird nicht unterstützt), Windows Server 2008 R2 (Server Core-Rolle wird mit SP1 oder höher unterstützt; Itanium wird nicht unterstützt)
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

