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?

Know a couple of people using Iron Speed for web app dev. They say it supports import/export off the shelf. Not sure I really belive this, since it probably leads to more work in the long run...Good luck.

Is there nobody out there who has had this sort of project to work on?

This code may help you check your Gridview binding.

DataTable dt = new DataTable();

        dt.Columns.Add(new DataColumn("Item #", typeof(int)));
        dt.Columns.Add(new DataColumn("Contract Number", typeof(string)));
        dt.Columns.Add(new DataColumn("Customer Name", typeof(string)));

        int i;
        for (i = 0; i < 40; i++)
        {
            DataRow dr = dt.NewRow();
            dr["Item #"] = i;


            dr["Customer Name"] = this.txtCustomerName.Text;
            dr["Contract Number"] = this.txtContractNumber.Text;
            dt.Rows.Add(dr);
        }

        this.GridView1.Visible = true;
        GridView1.DataSource = dt;
        GridView1.DataBind();

Thanks ciint ... I've since decided to develop a small VB program, as it seems more conducive to what I need.

Thanks for the help :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.