Programmeren in ASP.NET/FormView en DetailsView: verschil tussen versies

k
-lege regel
k (Robot: automatisch tekst vervangen (-{{GFDL-oud}} + ))
k (-lege regel)
 
{{Programmeren in ASP.NET}}
 
De FormView-control en de DetailsView zijn twee volledig nieuwe controls in ASP.NET 2.0, speciaal om individuele databankrecords te tonen en te wijzigen, toe te voegen of te verwijderen.
 
<asp:FormView ID="FormView1" runat="server" DataKeyNames="au_id" DataSourceID="AuthorsSource">
<EditItemTemplate>
au_id: <asp:Label ID="au_idLabel1" runat="server" Text='<%# Eval("au_id") %>'/><br />
au_lname: <asp:TextBox ID="au_lnameTextBox" runat="server" Text='<%# Bind("au_lname") %>'/><br />
au_fname: <asp:TextBox ID="au_fnameTextBox" runat="server" Text='<%# Bind("au_fname") %>'/><br />
phone: <asp:TextBox ID="phoneTextBox" runat="server" Text='<%# Bind("phone") %>'/><br />
address: <asp:TextBox ID="addressTextBox" runat="server" Text='<%# Bind("address") %>'/><br />
city: <asp:TextBox ID="cityTextBox" runat="server" Text='<%# Bind("city") %>'/><br />
state: <asp:TextBox ID="stateTextBox" runat="server" Text='<%# Bind("state") %>'/><br />
zip: <asp:TextBox ID="zipTextBox" runat="server" Text='<%# Bind("zip") %>'/><br />
contract: <asp:CheckBox ID="contractCheckBox" runat="server" Checked='<%# Bind("contract") %>' /><br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Update">
</EditItemTemplate>
<InsertItemTemplate>
au_id: <asp:TextBox ID="au_idTextBox" runat="server" Text='<%# Bind("au_id") %>'/><br />
au_lname: <asp:TextBox ID="au_lnameTextBox" runat="server" Text='<%# Bind("au_lname") %>'/><br />
au_fname: <asp:TextBox ID="au_fnameTextBox" runat="server" Text='<%# Bind("au_fname") %>'/><br />
phone: <asp:TextBox ID="phoneTextBox" runat="server" Text='<%# Bind("phone") %>'/><br />
address: <asp:TextBox ID="addressTextBox" runat="server" Text='<%# Bind("address") %>'/><br />
city: <asp:TextBox ID="cityTextBox" runat="server" Text='<%# Bind("city") %>'/><br />
state: <asp:TextBox ID="stateTextBox" runat="server" Text='<%# Bind("state") %>'/><br />
zip: <asp:TextBox ID="zipTextBox" runat="server" Text='<%# Bind("zip") %>'/><br />
contract: <asp:CheckBox ID="contractCheckBox" runat="server" Checked='<%# Bind("contract") %>' /><br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="Insert">
</InsertItemTemplate>
<ItemTemplate>
au_id: <asp:Label ID="au_idLabel" runat="server" Text='<%# Eval("au_id") %>'/><br />
au_lname: <asp:Label ID="au_lnameLabel" runat="server" Text='<%# Bind("au_lname") %>'/><br />
au_fname: <asp:Label ID="au_fnameLabel" runat="server" Text='<%# Bind("au_fname") %>'/><br />
phone: <asp:Label ID="phoneLabel" runat="server" Text='<%# Bind("phone") %>'/><br />
address: <asp:Label ID="addressLabel" runat="server" Text='<%# Bind("address") %>'/><br />
city: <asp:Label ID="cityLabel" runat="server" Text='<%# Bind("city") %>'/><br />
state: <asp:Label ID="stateLabel" runat="server" Text='<%# Bind("state") %>'/><br />
zip: <asp:Label ID="zipLabel" runat="server" Text='<%# Bind("zip") %>'/><br />
contract: <asp:CheckBox ID="contractLabel" runat="server" Checked='<%# Bind("contract") %>'
Enabled="false" /><br />
</ItemTemplate>
</asp:FormView>
 
==Vergelijking tussen de datacontrols==
{| class="prettytablewikitable" style="font-size:xx-small"
|-
|Control||Wanneer gebruiken?||Selected ItemTemplate||Edit ItemTemplate||opmaken in Visual Studio.NET||meerdere kolommen per pagina||gegevens automatisch tonen||ingebouwd sorteren||ingebouwd pagineren||client-side sorteren en pagineren
|volgende=User-controls
}}
{{subSub}}
 
{{sub}}
Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.