Click here to Skip to main content
15,172,297 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Repeater Template Desinging Pin
A_Griffin26-Sep-17 10:26
MemberA_Griffin26-Sep-17 10:26 
GeneralRe: Repeater Template Desinging Pin
Member 1337195126-Sep-17 10:28
MemberMember 1337195126-Sep-17 10:28 
GeneralRe: Repeater Template Desinging Pin
A_Griffin26-Sep-17 10:33
MemberA_Griffin26-Sep-17 10:33 
GeneralRe: Repeater Template Desinging Pin
Member 1337195126-Sep-17 10:36
MemberMember 1337195126-Sep-17 10:36 
GeneralRe: Repeater Template Desinging Pin
A_Griffin26-Sep-17 10:42
MemberA_Griffin26-Sep-17 10:42 
GeneralRe: Repeater Template Desinging Pin
Member 1337195126-Sep-17 10:44
MemberMember 1337195126-Sep-17 10:44 
AnswerRe: Repeater Template Desinging Pin
Rollin Shultz28-Sep-17 3:08
MemberRollin Shultz28-Sep-17 3:08 
QuestionHow can I properly use the Trace.Write() method inside of my for loop to print month and future values? Pin
Dorakta21-Sep-17 13:36
MemberDorakta21-Sep-17 13:36 
I am struggling with trying to figure out how I can output a trace message in ASP.NET using the Trace.Write() method inside of a for loop in order for a user to see the future value after 1 month, 10 months, and 50 months? The format should be like this:
Month{i}: & Value{futureValue}. So, for example, the format should look like this after the first month: "Month:" {i} "Value:"{futureValue}. i know that's not right but that's why I need help understanding how I can input the variables correctly into this method. I have researched my problem, but it's not specific to my individual problem. Here is the site I have researched before coming here: (http://www.c-sharpcorner.com/UploadFile/225740/how-to-write-custom-tracing-message-in-Asp-Net/)

<pre lang="c#"><pre>namespace XEx05FutureValue
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                for (int i = 50; i <= 500; i += 50)
                    ddlMonthlyInvestment.Items.Add(i.ToString());
        }

        protected void btnCalculate_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                int monthlyInvestment = Convert.ToInt32(ddlMonthlyInvestment.SelectedValue);
                decimal yearlyInterestRate = Convert.ToDecimal(txtInterestRate.Text);
                int years = Convert.ToInt32(txtYears.Text);

                decimal futureValue = this.CalculateFutureValue(monthlyInvestment,
                    yearlyInterestRate, years);

                lblFutureValue.Text = futureValue.ToString("c");
            }
        }

        protected decimal CalculateFutureValue(int monthlyInvestment,
        decimal yearlyInterestRate, int years)
        {
            int months = years * 12;
            decimal monthlyInterestRate = yearlyInterestRate / 12 / 100;
            decimal futureValue = 0;
            for (int i = 0; i < months; i++)
            {
                futureValue = (futureValue + monthlyInvestment)
                    * (1 + monthlyInterestRate);
                if (Trace.IsEnabled)
                {
                    Trace.Write({i} {futureValue});
                }
            }
            return futureValue;
        }

        protected void btnClear_Click(object sender, EventArgs e)
        {
            ddlMonthlyInvestment.SelectedIndex = 0;
            txtInterestRate.Text = "";
            txtYears.Text = "";
            lblFutureValue.Text = "";
        }
    }
}


AnswerRe: How can I properly use the Trace.Write() method inside of my for loop to print month and future values? Pin
Richard Deeming22-Sep-17 3:11
mveRichard Deeming22-Sep-17 3:11 
QuestionSystem.ServiceModel.FaultException`1 occurred Pin
jkirkerx21-Sep-17 13:05
professionaljkirkerx21-Sep-17 13:05 
AnswerRe: System.ServiceModel.FaultException`1 occurred Pin
jkirkerx22-Sep-17 7:29
professionaljkirkerx22-Sep-17 7:29 
AnswerUPS Rate SOAP WSDL Errors in VS2017 Service Reference, An exception has been raised as a result of client data. Pin
jkirkerx22-Sep-17 12:07
professionaljkirkerx22-Sep-17 12:07 
QuestionRepeater2 is not getting populated with data from Repeater2. Any ideas? Pin
samflex20-Sep-17 5:38
Membersamflex20-Sep-17 5:38 
AnswerRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
Richard Deeming20-Sep-17 11:15
mveRichard Deeming20-Sep-17 11:15 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
samflex21-Sep-17 4:50
Membersamflex21-Sep-17 4:50 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
Richard Deeming21-Sep-17 6:12
mveRichard Deeming21-Sep-17 6:12 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
samflex21-Sep-17 7:33
Membersamflex21-Sep-17 7:33 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
Richard Deeming21-Sep-17 7:39
mveRichard Deeming21-Sep-17 7:39 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
samflex21-Sep-17 8:26
Membersamflex21-Sep-17 8:26 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
Richard Deeming21-Sep-17 8:32
mveRichard Deeming21-Sep-17 8:32 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
samflex21-Sep-17 9:32
Membersamflex21-Sep-17 9:32 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
Richard Deeming21-Sep-17 9:55
mveRichard Deeming21-Sep-17 9:55 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
samflex21-Sep-17 10:39
Membersamflex21-Sep-17 10:39 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
Richard Deeming21-Sep-17 10:47
mveRichard Deeming21-Sep-17 10:47 
GeneralRe: Repeater2 is not getting populated with data from Repeater2. Any ideas? Pin
samflex21-Sep-17 11:03
Membersamflex21-Sep-17 11:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.