我正在使用我的 gridview 的页脚添加一条新记录,尽管我不喜欢这种格式。我希望能够让我的保存/取消按钮与编辑/删除命令字段保持一致。我不知道该怎么做。有人可以帮忙吗。干杯
<asp:GridView ID="Grd" runat="server" AutoGenerateColumns="false" OnRowEditing="Grd_RowEditing"
OnRowCancelingEdit="Grd_RowCancelingEdit" OnRowUpdating="Grd_RowUpdating"
Width="600px" CssClass="HomeDG" SelectedRowStyle-CssClass="HomeDGSelected" RowStyle-CssClass="HomeDGItem"
AlternatingRowStyle-CssClass="HomeDGAlternating" HeaderStyle-CssClass="HomeDGhead"
PageSize="10">
<Columns>
<asp:TemplateField HeaderText="Employee">
<ItemTemplate>
<asp:HiddenField ID="hfID" runat="server" Value='<%# Bind("Emp_ID")%>' />
<asp:Label ID="LblEmployee" runat="server" Text='<%# Bind("Emp_Name")%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlNewEmp" runat="Server" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Start Date">
<EditItemTemplate>
<asp:TextBox ID="TxtStartDate" runat="server"
Text='<%# Eval("Start_Date","{0:dd-MMM-yyyy}") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="TxtStartDate" runat="Server" />
<asp:CalendarExtender ID="calStartDate" runat="server" TargetControlID="TxtStartDate"
Format="dd-MMM-yyyy" />
<asp:Button ID="btnAddNewSave" runat="server" Text="Save" CausesValidation="False"
OnClick="btnAddNewSave_Click" />
<asp:Button ID="btnAddNewCancel" runat="server" Text="Cancel" OnClick="btnAddNewCancel_Click" />
</FooterTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" ShowDeleteButton="True" CausesValidation="False" />
</Columns>
</asp:GridView>
<asp:Button ID="btnAddNew" runat="server" Text="Add" CausesValidation="False" OnClick="btnAddNew_Click" />