how i want to make sure that my footer is appear in the right place?
example:
my pages appear like this.
Number Name Bil Date
1 Am's 100 2/2/2012
2 Mat 200 3/2/2012
Total Amount 300.
to below:
Number Name Bil Date
1 Am's 100 2/2/2012
2 Mat 200 3/2/2012
Total Amount 300.
How i want to make sure Total Amount is under Name and Total Bil (300) in the footer of Bil
Loading
Satyapriya NayakPosted May 3, 2012, 8:31 AM
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Sub_total_gridview._Default" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Sub_total_gridview
{
public partial class _Default : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
void bind()
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from test";
com =new SqlCommand(str, con);
sqlda = new SqlDataAdapter(str, con);
ds =new DataSet();
sqlda.Fill(ds, "test");
GridView1.DataSource = ds;
GridView1.DataMember = "test";
GridView1.DataBind();
con.Close();
}
public string totalbills()
{
SqlConnection con = new SqlConnection(strConnString);
str = "SELECT SUM(bill) from test";
com = new SqlCommand(str, con);
con.Open();
decimal Totalbill = Convert.ToDecimal(com.ExecuteScalar());
con.Close();
con.Dispose();
com.Dispose();
return string.Format(Totalbill.ToString());
}
protected void Page_Load(object sender, EventArgs e)
{
bind();
}
}
}
Thanks
If this post helps you mark it as answer