Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
8
Reply
How to calculate( sum) of the data grid column.
Kasuni Abegunawardana
Dec 4 2017 12:42 PM
171
Reply
Hi all,
I have retreive data to a data grid without sqldatasource.
private void BindGrid2()
{
string constr = (ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString);
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT * FROM OnlineDiary_tb where U_EmailAddress='" + Session["U_Email"].ToString() + "'and Date='"+ DateTime.Today.ToString()+"' ", con))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
GridView2.DataSource = dt;
GridView2.DataBind();
}
}
}
}
Now want to calculate colunm data.
Thank you in advance.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
8
)
Next Recommended Forum
Validation on Gridview
ASP.NET MVC Toolkit