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
Sharad Mishra
NA
321
6.8k
Index was out of range. Must be non-negative and less than t
Jul 16 2016 2:23 AM
.cs
int loan_amt = Int32.Parse(txtLoan_Amount.Text);
double Int_rate = Double.Parse(TxtInterest_Rate.Text);
string freq = DdlFrequency.SelectedItem.Text;
int duration = Int32.Parse(txtDuration.Text);
double Remaining_amt = Int32.Parse( txtLoan_Amount.Text);
while (Remaining_amt > 0)
{
for(int i =1; i<= duration; i++)
{
double monthly_installment = Math.Round(Financial.Pmt((Int_rate / 100) / 12, duration, -(loan_amt)), 0, MidpointRounding.AwayFromZero);
double interest_amt= Math.Round((Remaining_amt * Int_rate )/100/12 ,0,MidpointRounding.AwayFromZero);
GridView1.Rows[i].Cells[1].Text = i.ToString();
Remaining_amt= Remaining_amt- (monthly_installment-interest_amt);
GridView1.Rows[i].Cells[2].Text = Remaining_amt.ToString();
GridView1.Rows[i].Cells[3].Text = (monthly_installment - interest_amt).ToString();
GridView1.Rows[i].Cells[4].Text = interest_amt.ToString();
GridView1.Rows[i].Cells[5].Text = "";
}
}
.aspx
<asp:GridView ID="GridView1" runat="server" CellPadding="4"
ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField HeaderStyle-Width="120px" HeaderText="Installment No" DataField="" />
<asp:BoundField HeaderStyle-Width="120px" HeaderText=" Remaining Amount" DataField="" />
<asp:BoundField HeaderStyle-Width="120px" HeaderText=" Principle" DataField="" />
<asp:BoundField HeaderStyle-Width="120px" HeaderText=" Interest" DataField="" />
<asp:BoundField HeaderStyle-Width="120px" HeaderText=" Total Emi" DataField="" />
</Columns>
</asp:GridView>
Reply
Answers (
6
)
how to remove data that bind inside repeater in c#
excel data reader read excel file and data add my list