我有一个GridView,其中包含5列数据和两列空。还有一个按钮编辑,我可以编辑每一行。只有在我按下按钮编辑并向表单添加数据并完成后,两列才会变空。我怎样才能做到这一点 ? 我尝试使用“没有数据”的EmptyDataText,但它不起作用。
我的GridView没有显示空数据的行。
我正在使用ASP.NET C#
<asp:GridView ID="GridViewSO" runat="server" DataSourceID="SqlDataSourceShippingOffice" AutoGenerateColumns="False" OnRowDataBound="GridViewSO_RowDataBound" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" Font-Names="Calibri" Font-Size="8pt" EmptyDataText="No data" >
<AlternatingRowStyle BackColor="#DCDCDC"></AlternatingRowStyle>
<Columns>
<asp:TemplateField HeaderText="Nr. crt.">
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="P_ID" HeaderText="P.ID" SortExpression="ID" />
<asp:BoundField DataField="S_ID" HeaderText="S.ID" SortExpression="ID1" />
<asp:BoundField DataField="DATE" HeaderText="Date" SortExpression="DATE" />
<asp:BoundField DataField="PLACE" HeaderText="Place" SortExpression="PLACE" />
<asp:BoundField DataField="DATE_U" HeaderText="DateU" SortExpression="DATE_U" />
<asp:BoundField DataField="TYPE" HeaderText="Type" SortExpression="TYPE" />
<asp:BoundField DataField="CAR" HeaderText="Car" SortExpression="CAR" />
<asp:BoundField DataField="EH" HeaderText="EH" SortExpression="EH" />
<asp:BoundField DataField="COND" HeaderText="Cond" SortExpression="COND" />
<asp:BoundField DataField="NAME" HeaderText="Name" SortExpression="NAME" />
<asp:BoundField DataField="REFERENT" HeaderText="Referent" ReadOnly="True" SortExpression="REFERENT" />
<asp:TemplateField HeaderText="Nr Form">
<ItemTemplate>
<asp:TextBox ID="txtSOGV" runat="server" Enabled="False" Rows="4" TextMode="MultiLine" Style="overflow: auto" Height="45px" Width="64px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnEditSO" runat="server" Text="Edit" OnClick="btnEditSO_Click" CausesValidation="False" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ID" HeaderText="REF_ID" SortExpression="ID" />
</Columns>
<EmptyDataRowStyle BackColor="#CCCCFF" Font-Bold="True" ForeColor="#FF3300" />
<FooterStyle BackColor="#CCCCCC" ForeColor="Black"></FooterStyle>
<HeaderStyle BackColor="#000084" Font-Bold="False" ForeColor="White" Font-Size="12pt"></HeaderStyle>
<PagerStyle HorizontalAlign="Center" BackColor="#999999" ForeColor="Black"></PagerStyle>
<RowStyle BackColor="#EEEEEE" ForeColor="Black"></RowStyle>
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White"></SelectedRowStyle>
<SortedAscendingCellStyle BackColor="#F1F1F1"></SortedAscendingCellStyle>
<SortedAscendingHeaderStyle BackColor="#0000A9"></SortedAscendingHeaderStyle>
<SortedDescendingCellStyle BackColor="#CAC9C9"></SortedDescendingCellStyle>
<SortedDescendingHeaderStyle BackColor="#000065"></SortedDescendingHeaderStyle>
</asp:GridView>
这是我的GridView。并且只有参照物和Nr形式首先是空的。