YES, Maybe. But for this, you will need to use <FooterTemplate> inside <TemplateField> . Use TemplateFields for each of the columns, and set the FooterTemplate for each of the columns.
NOTE. The ID column appears here as the primary key. Therefore, remove the <FooterTemplate> from the corresponding <TemplateField> defined for the ID column if the ID is a Primary Key OR an automatically generated field in your database.
NOTE II: <FooterTemplate> will simply contain only a text field.
<Columns> <asp:TemplateField> <EditItemTemplate> <asp:LinkButton ID="lnkBtnUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton> <asp:LinkButton ID="lnkBtnCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </EditItemTemplate> <FooterTemplate> <asp:LinkButton ID="lnkBtnInsert" runat="server" CommandName="Insert">Insert</asp:LinkButton> </FooterTemplate> <ItemTemplate> <asp:LinkButton ID="lnkBtnEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> <asp:LinkButton ID="lnkBtnDelete" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"> </asp:LinkButton> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="ID"> <EditItemTemplate> <asp:TextBox ID="TextBoxID" runat="server" Text='<%# Bind("ID") %>'> </asp:Label> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("ID") %>'> </asp:Label> </ItemTemplate> <FooterTemplate> <asp:TextBox ID="txtID" runat="server"></asp:TextBox> </FooterTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="MOVIE"> <EditItemTemplate> <asp:TextBox ID="TextBoxMovie" runat="server" Text='<%# Bind("Movie") %>'></asp:TextBox> </EditItemTemplate> <FooterTemplate> <asp:TextBox ID="txtMovie" runat="server"></asp:TextBox> </FooterTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("Movie")%>'> </asp:Label> </ItemTemplate> </asp:TemplateField>
Now there are two ways to insert data. Either you can use the GridView OnRowCommand event, or you can handle the OnClick event of your Insert button.
source share