TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kasuni Abegunawardana
NA
211
125k
How to calculate( sum) of the data grid column.
Dec 4 2017 12:42 PM
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.
Reply
Answers (
8
)
Validation on Gridview
ASP.NET MVC Toolkit