Good afternoon,
I have a problem... Else I wouldn't be posting here, right?
My quandary is thus:
I have an empty table in a database that I want a user to be able to fill. This will occur when employees are replaced for sick leaves, etc.
I'd like to be able to have them populate (insert) information into the table, where I can then match it into another table that I have for a report.
I've been looking up using GridView ... a lot ... and it's kind of helping me get back into the swing of things code-wise, but I can't, for the life of me, get a footer row to display text boxes so that I can add information to the table.
I barely have any code-behind for the page_load event, no subs written ... Just the GridView code.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataSourceID="SCHOOL_LISTING" ForeColor="#333333"
GridLines="None" AllowSorting="True" AutoGenerateEditButton="True"
showheaderwhenempty="True" ShowFooter="true">
<EmptyDataRowStyle BackColor="lightblue" ForeColor="Red" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:TemplateField HeaderText="EMPL_MATR" SortExpression="EMPL_MATR">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("EMPL_MATR") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EMPL_FIRST" SortExpression="EMPL_FIRST">
<FooterTemplate>
<asp:TextBox ID="EmployeeFirstName" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("EMPL_FIRST") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="EMPL_LAST" SortExpression="EMPL_LAST">
<FooterTemplate>
<asp:TextBox ID="EmployeeLastName" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("EMPL_LAST") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="REPLACING" SortExpression="REPLACING">
<FooterTemplate>
<asp:TextBox ID="EmployeeReplacedBy" runat="server" style="margin-bottom: 0px"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("REPLACING") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Test" NullDisplayText="N/A" DataField="EMPL_MATR" />
<asp:TemplateField Visible="true">
<FooterTemplate>
<asp:Button ID="AddEmployee" runat="server" Text="Update" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
<asp:SqlDataSource ID="SCHOOL_LISTING" runat="server"
ConnectionString="<%$ ConnectionStrings:PHONE_LISTConnectionString %>"
SelectCommand="SELECT * FROM [REPLACEMENT]" InsertCommand="INSERT INTO [REPLACEMENT](EMPL_MATR, EMPL_FIRST, EMPL_LAST, REPLACING)
VALUES(@EMPL_MATR, @EMPL_FIRST, @EMPL_LAST, @REPLACEMENT)">
<insertparameters>
<asp:Parameter Type="String" Name="EMPL_MATR" />
<asp:Parameter Type="String" Name="EMPL_FIRST" />
<asp:Parameter Type="String" Name="EMPL_LAST" />
<asp:Parameter Type="String" Name="REPLACEMENT" />
</insertparameters>
</asp:SqlDataSource>
You can see that I have the Footer row in there, with an "add" button ... but whenever I debug, I do not get a Footer row at all. Nothing. Zip. I get a Header row, but no Footer.
I've even scratched the webapplication, and started over... Same result.
Anyone be able to help?