0

元の合計金額の合計売上高を表示できるように、フッターを追加しようとしています。

フッターが表示されない理由を教えてください。

ネットからコピーしてGridviewに入れようとしましたが、それでも失敗しました。

誰 ?ありがとうございました。

    <div id="div_print1">
           <%-- <asp:Panel runat="server" ID="pnlInvConfirm" GroupingText="CONFIRM"> --%>
            <asp:GridView ID="GridView1" runat="server" HorizontalAlign="Center" ShowFooter="true" OnRowDataBound="GridView1_RowDataBound" AutoGenerateColumns="False">
                <RowStyle HorizontalAlign="Center" />
                <AlternatingRowStyle HorizontalAlign="Center" />

            <columns>
            <asp:templatefield headertext="Invoice ID">
                  <itemtemplate>
                        <asp:Label ID="lblInvID" Text='<%# Eval("invID") %>' runat="server" /> 
                     </itemtemplate>
                    <ItemStyle HorizontalAlign="Center" />
                 </asp:templatefield>

                <asp:templatefield headertext="NRIC">
                  <itemtemplate>
                       <asp:Label ID="lblcusNRIC" runat="server" Text='<%#Eval("cusNRIC") %>'></asp:Label>
                     </itemtemplate>
                    <ItemStyle HorizontalAlign="Center" />
                 </asp:templatefield>

                 <asp:templatefield headertext="Name">
                  <itemtemplate>
                       <asp:Label ID="lblcusName" runat="server" Text='<%#Eval("cusName")%>'></asp:Label>
                     </itemtemplate>
                     <ItemStyle HorizontalAlign="Center" />
                 </asp:templatefield>

                <asp:templatefield headertext="Contact Number">
                  <itemtemplate>
                       <asp:Label ID="lblcusHP1" runat="server" Text='<%#Eval("cusHP1") %>'></asp:Label>
                     </itemtemplate>
                    <ItemStyle HorizontalAlign="Center" />
                 </asp:templatefield>

                <asp:templatefield headertext="Invoice Date">
                <itemtemplate>
                <asp:Label ID="lblinvDate" runat="server" Text='<%#Eval ("invDate","{0:yyyy-MM-dd}") %>'></asp:Label>
                </itemtemplate>
                </asp:templatefield>

                <asp:templatefield headertext="Last Updated Date">
                <itemtemplate>
                <asp:Label ID="lblinvLastUpdated" runat="server" Text='<%#Eval ("invLastUpdated","{0:yyyy-MM-dd}") %>'></asp:Label>
                </itemtemplate>
                </asp:templatefield>

                <asp:templatefield headertext="Deposit (RM)">
                  <itemtemplate>
                    <asp:Label ID="lblinvDeposit" runat="server" Text='<%#Eval("invDeposit") %>'></asp:Label>
                  </itemtemplate>
                    <ItemStyle HorizontalAlign="Center" />
                 </asp:templatefield>

                <asp:templatefield headertext="New Balance (RM)">
                  <itemtemplate> 
                    <asp:Label ID="lblinvNewBalance" runat="server" Text='<%#Eval("invNewBalance") %>'></asp:Label>
                  </itemtemplate>
                    <FooterTemplate>
                        <asp:Label ID="lblttlSales" runat="server" Text="Total Sales"></asp:Label>
                   </FooterTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                 </asp:templatefield>

                <asp:templatefield headertext=" Original Total Amount (RM)">
                  <itemtemplate>
                       <asp:Label ID="lblinvGrandTotal" runat="server" Text='<%#Eval("invGrandTotal") %>'></asp:Label>
                     </itemtemplate>
                    <ItemStyle HorizontalAlign="Center" />
                     <FooterTemplate>
                        <asp:Label ID="lblTotalSales" runat="server" ></asp:Label>
                    </FooterTemplate>
                 </asp:templatefield>

            </columns>  
            </asp:GridView>
           <%-- </asp:Panel> --%>
            </div>

そしてここに.csコードがあります:-

     protected void G1(string sValue)
{
    //pnlInvConfirm.Visible = true;
    string inv_Status = "Confirm";

    if (rdlSearchRep.Text == "All")
    {
        try
        {
            MySqlConnection con = new MySqlConnection("server=localhost;userid=root;password=;database=obsystem");
            con.Open();

            //MySqlCommand cmd = new MySqlCommand("SELECT * FROM reportdetailsinv",con);

            MySqlCommand cmd = new MySqlCommand("SELECT * FROM reportdetailsinv WHERE invStatus='" + inv_Status + "' AND reportID LIKE ?search OR reportType LIKE ?search OR reportDate LIKE ?search OR cusNRIC LIKE ?search", con);

            cmd.Parameters.AddWithValue("@search", string.Format("%{0}%", txtSearchRep.Text));

            MySqlDataAdapter da = new MySqlDataAdapter(cmd);

            DataSet ds = new DataSet();
            da.Fill(ds, "reportdetailsinv");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
            con.Close();
        }
        catch
        {

        }
    }
    else if (rdlSearchRep.Text == "Report ID")
    {
        try
        {
            MySqlConnection con = new MySqlConnection("server=localhost;userid=root;password=;database=obsystem");
            con.Open();

            MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM reportdetailsinv WHERE invStatus='" + inv_Status + "' AND reportID='" + sValue + "'ORDER BY paymentDate ASC", con);

            DataSet ds = new DataSet();
            da.Fill(ds, "reportdetailsinv");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
            con.Close();

        }
        catch
        {

        }
    }
    else if (rdlSearchRep.Text == "Report Type")
    {
        try
        {
            MySqlConnection con = new MySqlConnection("server=localhost;userid=root;password=;database=obsystem");
            con.Open();

            MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM reportdetailsinv WHERE invStatus='" + inv_Status + "' AND reportType='" + sValue + "' ORDER BY reportID ASC", con);

            DataSet ds = new DataSet();
            da.Fill(ds, "reportdetails");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
            con.Close();
        }
        catch
        {

        }
    }
    else if (rdlSearchRep.Text == "Report Date")
    {
        try
        {
            MySqlConnection con = new MySqlConnection("server=localhost;userid=root;password=;database=obsystem");
            con.Open();

            MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM reportdetailsinv WHERE invStatus='" + inv_Status + "' AND reportDate='" + sValue + "'ORDER BY reportID ASC", con);

            DataSet ds = new DataSet();
            da.Fill(ds, "reportdetails");
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
            con.Close();
        }
        catch
        {

        }
    }

}

4

1 に答える 1