我正在使用一些旧的Webforms代码。我想将h3标题与来自网格的动态内容一起放在asp:Commandfield按钮上方。 (DataField =“ FacilityName”)
这是我的网格的(部分)代码,可以正常工作。
<lfr:SecureDetailsView ID="FirstView" runat="server" AutoGenerateRows="False"
DataKeyNames="FacilityID" DataSourceID="FirstView"
DesiredInsert="false" DesiredUpdate="true" DesiredDelete="false"
OnDataBound="FirstView" OnItemUpdating="Facility_ItemUpdating"
OnItemDeleting="Facility_ItemDeleting" OnItemInserted="Facility_ItemInserted" CommandRowStyle-Wrap="True" FooterStyle-Wrap="True" CellPadding="0" CommandRowStyle-BackColor="White" BorderColor="White">
<FieldHeaderStyle Width="160px" />
<Fields>
<asp:CommandField ShowEditButton="true"
ButtonType="Button" ControlStyle-CssClass="command_button" />
<lfr:BetterBoundField DataField="MailCode" HeaderText="Store ID" MaxLength="20"
ReadOnly="true" InsertVisible="false" ControlStyle-Width="30%" />
<lfr:BetterBoundField DataField="FacilityName" HeaderText="Facility Name" MaxLength="128"
ReadOnly="true" ControlStyle-Width="95%" />
轻松吗?在此先感谢您,祝您愉快!
答案 0 :(得分:2)
您可以尝试添加templateField,例如:
<Fields>
<asp:TemplateField HeaderText="Facility Name">
<ItemTemplate>
<h3><asp:Label ID="someid" runat="server" BorderStyle="None" Text='<%# Eval("FacilityName") %>'></asp:Label></h3>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="true"
ButtonType="Button" ControlStyle-CssClass="command_button" />
编辑:您应该将其添加到标记之后和commandField标记之前。也不确定标题是否已根据您的需要进行了更新。 希望这会有所帮助