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.9k
RunningBalance in Columns of Gridview in ASP.NET Webforms C#
Oct 19 2016 4:45 AM
Hi! I created a Cash Book webform application in C#. In the columns Debit, Credit and Balance, I want to get the running balance from Debit and Credit columns.
I'm using a TemplateField. Here's what I started but still no luck. Hope someone can help me.
protected
void
GridView1_RowDataBound(
object
sender, GridViewRowEventArgs e)
{
DataRowView dtview = e.Row.DataItem
as
DataRowView;
if
(e.Row.RowType == DataControlRowType.DataRow)
{
Label Debit = (Label)e.Row.FindControl(
"lblDebit"
);
GetDebit += GetDebit + Convert.ToDecimal(Debit.Text);
Label Credit = (Label)e.Row.FindControl(
"lblCredit"
);
GetCredit += GetCredit + Convert.ToDecimal(Credit.Text);
Label Balance = (Label)e.Row.FindControl(
"lblBalanceForwared"
);
GetBalance += GetBalance + Convert.ToDecimal(Balance.Text) + GetBalance- GetCredit;
}
}
Another thing, I am just a neophyte in programming. Thanks in advance.
Reply
Answers (
2
)
a simple example using codefirst approach
Db saves only first letter of the record