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
Jes Sie
741
1.2k
281.8k
Sum of Gridview colum that has a dynamically added row.
Mar 1 2017 10:16 PM
Before I would ask my nth question, I would like to thank everybody for your help. As an aspiring c# programmer your valued response is really a big help.
I'm trying to make a cashiering system. For the details I'm using a gridview with a rows that are dynamically added. Now, I want to get the sum of the column "Amount Paid" but all the codes that I tried failed. Please note that this is a data entry. To make my self clear, I'm attaching an image and my code behind. Thanks in advance for your help.
Below is my code:
decimal amount = 0;
protected
void
Gridview1_RowDataBound(
object
sender, GridViewRowEventArgs e)
{
if
(e.Row.RowType == DataControlRowType.DataRow)
{
decimal
amount = Convert.ToDecimal(e.Row.Cells[12].FindControl(
"txtNetAmountReceived"
).ToString());
amount += Convert.ToDecimal(amount);
}
if
(e.Row.RowType == DataControlRowType.Footer)
{
Label lblamount = (Label)e.Row.FindControl(
"lblAmountPaid"
);
NetPremium.Value = totalPaid.ToString(
"N2"
);
}
}
Reply
Answers (
2
)
How to add javascript file link in aspx page?
Why we need OOPs in Programming language?