我正在创建一个用户可以编辑其用户信息的页面。我在 ASP 中使用 DetailsView 控件来显示数据。如何更改字段的名称,例如“FirstName”显示为“First Name”?
<asp:SqlDataSource ID="sauceatronConnString" runat="server"
ConnectionString="<%$ ConnectionStrings:sauceatronConnString %>"
ProviderName="<%$ ConnectionStrings:sauceatronConnString.providerName %>"
SelectCommand="SELECT FirstName, LastName, ShipAddress, ShipCity, ShipState, ShipZipCode, ShipCountry, Phone, Email, Pwd, BillAddress, BillCity, BillState, BillZipCode, BillCountry FROM [Customers]"
UpdateCommand="UPDATE [Customers] SET [Firstname] = @Firstname,
[Lastname] = @Lastname, [Age] = @Age,
[IsFullTime] = @IsFullTime, [Username] = @Username, [Password] = @Password"></asp:SqlDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" DataSourceId="sauceatronConnString" AutoGenerateRows="true" AutoGenerateEditButton="True" />
<Fields>
<asp:BoundField DataField="FirstName" HeaderText="CustomerID" ReadOnly="True" />
<asp:BoundField DataField="LastName" HeaderText="ContactName" />
<asp:BoundField DataField="ShipAddress" HeaderText="ContactTitle" />
<asp:BoundField DataField="ShipCity" HeaderText="CompanyName" />
<asp:BoundField DataField="ShipZipCode" HeaderText="Address" />
<asp:BoundField DataField="ShipCountry" HeaderText="City" />
<asp:BoundField DataField="Phone" HeaderText="Region" />
<asp:BoundField DataField="Email" HeaderText="PostalCode" />
<asp:BoundField DataField="Pwd" HeaderText="Country" />
<asp:BoundField DataField="BillAddress" HeaderText="Phone" />
<asp:BoundField DataField="BillCity" HeaderText="Fax" />
<asp:BoundField DataField="BillState" HeaderText="Phone" />
<asp:BoundField DataField="BillZipCode" HeaderText="Fax" />
</Fields>
<UpdateParameters>
<asp:Parameter Name="Firstname" Type="String"/>
<asp:Parameter Name="Lastname" Type="String"/>
<asp:Parameter Name="Age" Type="Int32"/>
<asp:Parameter Name="IsFullTime" Type="Boolean"/>
<asp:Parameter Name="Username" Type="String"/>
<asp:Parameter Name="Password" Type="String"/>
</UpdateParameters>
<asp:/DetailsView>
</asp:Content>