Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy isnt my footer displaying in gridview?
    primarykey
    data
    text
    <p>I have been trying to add footer so that it can display Total Sales for Original Total Amount. </p> <p>Can someone please help me why isnt't my footer displaying ? </p> <p>I have tried copying from the net and put it into the Gridview, but still failed.</p> <p>Anyone ? Thank you. </p> <pre><code> &lt;div id="div_print1"&gt; &lt;%-- &lt;asp:Panel runat="server" ID="pnlInvConfirm" GroupingText="CONFIRM"&gt; --%&gt; &lt;asp:GridView ID="GridView1" runat="server" HorizontalAlign="Center" ShowFooter="true" OnRowDataBound="GridView1_RowDataBound" AutoGenerateColumns="False"&gt; &lt;RowStyle HorizontalAlign="Center" /&gt; &lt;AlternatingRowStyle HorizontalAlign="Center" /&gt; &lt;columns&gt; &lt;asp:templatefield headertext="Invoice ID"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblInvID" Text='&lt;%# Eval("invID") %&gt;' runat="server" /&gt; &lt;/itemtemplate&gt; &lt;ItemStyle HorizontalAlign="Center" /&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext="NRIC"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblcusNRIC" runat="server" Text='&lt;%#Eval("cusNRIC") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/itemtemplate&gt; &lt;ItemStyle HorizontalAlign="Center" /&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext="Name"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblcusName" runat="server" Text='&lt;%#Eval("cusName")%&gt;'&gt;&lt;/asp:Label&gt; &lt;/itemtemplate&gt; &lt;ItemStyle HorizontalAlign="Center" /&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext="Contact Number"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblcusHP1" runat="server" Text='&lt;%#Eval("cusHP1") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/itemtemplate&gt; &lt;ItemStyle HorizontalAlign="Center" /&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext="Invoice Date"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblinvDate" runat="server" Text='&lt;%#Eval ("invDate","{0:yyyy-MM-dd}") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext="Last Updated Date"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblinvLastUpdated" runat="server" Text='&lt;%#Eval ("invLastUpdated","{0:yyyy-MM-dd}") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext="Deposit (RM)"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblinvDeposit" runat="server" Text='&lt;%#Eval("invDeposit") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/itemtemplate&gt; &lt;ItemStyle HorizontalAlign="Center" /&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext="New Balance (RM)"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblinvNewBalance" runat="server" Text='&lt;%#Eval("invNewBalance") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/itemtemplate&gt; &lt;FooterTemplate&gt; &lt;asp:Label ID="lblttlSales" runat="server" Text="Total Sales"&gt;&lt;/asp:Label&gt; &lt;/FooterTemplate&gt; &lt;ItemStyle HorizontalAlign="Center" /&gt; &lt;/asp:templatefield&gt; &lt;asp:templatefield headertext=" Original Total Amount (RM)"&gt; &lt;itemtemplate&gt; &lt;asp:Label ID="lblinvGrandTotal" runat="server" Text='&lt;%#Eval("invGrandTotal") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/itemtemplate&gt; &lt;ItemStyle HorizontalAlign="Center" /&gt; &lt;FooterTemplate&gt; &lt;asp:Label ID="lblTotalSales" runat="server" &gt;&lt;/asp:Label&gt; &lt;/FooterTemplate&gt; &lt;/asp:templatefield&gt; &lt;/columns&gt; &lt;/asp:GridView&gt; &lt;%-- &lt;/asp:Panel&gt; --%&gt; &lt;/div&gt; </code></pre> <p>and here is the .cs code :-</p> <pre><code> 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 { } } </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload