我有一个页脚模板,它会将文本框添加到网格中。即使网格中没有数据,我也希望显示页脚模板。
<asp:GridView AutoGenerateColumns="false" EnableViewState="true"
ID="gvServiceGoalsAndFactors" runat="server" GridLines="None" BorderWidth="1" BorderColor="Brown"
AlternatingRowStyle-BackColor="Cyan" HeaderStyle-BackColor="ActiveCaption" ShowFooter="true">
<Columns>
<asp:TemplateField HeaderText= "Service Goal" >
<HeaderTemplate>Service(%)</HeaderTemplate>
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:Label ID="lblGoal" Visible="true" runat="server" Text='<%# Eval("Service") %>' />
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtService" Style="margin-left: 350px" Visible='<%# IsInEditMode %>' runat="server" Text='<%#Eval("Service")%>' MaxLength="10">
</asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField >
<HeaderTemplate>Service Factor</HeaderTemplate>
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:Label ID="lblFactor" Visible='<%# ! IsInEditMode %>' runat="server" Text='<%# Eval("Factor") %>' />
<asp:TextBox ID="txtFactor" Visible='<%# IsInEditMode %>' runat="server" Text='<%#Eval("Factor")%>' MaxLength="10">
</asp:TextBox>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtFactor" Style="margin-left: 218px" Visible='<%# IsInEditMode %>' runat="server" Text='<%#Eval("Factor")%>' MaxLength="10">
</asp:TextBox>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
这是我的网格
答案 0 :(得分:0)
将网格的EmptyDataText设置为当网格为emmpty时要使用的文本