Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8844215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:25:49+00:00 2026-06-14T11:25:49+00:00

I’m using a DropDownList to pull up data from FormViews and properly calculate it.

  • 0

I’m using a DropDownList to pull up data from FormViews and properly calculate it. I use Label13 to see what the students Run Time is. If I select user one and place all the data it calculates a result, then I select a user two(which has no data yet), now if I select user one again without placing any information into user two it will copy Label13 results from user ones data to user two.(if that makes sense). Specifically Label13.

Here is some code:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Label13.Text = "";

        if (DropDownList1.SelectedValue != "0")
        {
            Score();

        }
    }
 protected void Score()
    {
        Label13.Text = "";

        //Button1.Visible = true;
        Button5.Visible = true;
        Label19.Visible = false;
        UpdatePanel4.Visible = true;

        FormView2.DataBind();
        Label sitL = ((Label)FormView2.FindControl("SitUpsLabel"));
        Label pushL = ((Label)FormView2.FindControl("pushUpsLabel"));
        Label MeterL = ((Label)FormView2.FindControl("MeterLabel"));

        if (DropDownList1.SelectedValue != "0")
        {
            if (sitL.Text != "" || pushL.Text != "" || MeterL.Text != "")
            {

                int count = 0;
                int counter2 = 0;
                string test = sitL.Text;
                decimal val;
                string test2 = pushL.Text;
                decimal val2;
                string test3 = MeterL.Text;
                decimal val3;

                Decimal.TryParse(test, out val);
                Decimal.TryParse(test2, out val2);
                Decimal.TryParse(test3, out val3);
                //decimal holder = 0;
                //decimal holder2 = 0;
                //decimal scores = 0;


                for (int i = 0; i < situps.Length; i++)
                {
                    if (val == 30 + count)
                    {
                        Label14.Text = "SitUps Score: " + situps[i];
                        holder = situps[i];
                    }
                    count = count + 1;
                }
                for (int i = 0; i < pushups.Length; i++)
                {
                    if (val2 == 21 + counter2)
                    {
                        Label15.Text = "Push Ups Score: " + pushups[i];
                        holder2 = pushups[i];
                    }
                    counter2 = counter2 + 1;
                }

                decimal counter = 0;
                decimal sideCounter = 0;

                int placer = 0;
                for (int i = 0; i < 1700; i++)
                {

                    if (val3 == 56 + counter)
                    {
                        Label20.Text = "300 Meter: " + meterRun[placer];
                        holder3 = meterRun[placer];


                    }
                    counter = counter + .01M;
                    sideCounter = sideCounter + .01M;
                    if (sideCounter >= .5M)
                    {
                        placer++;
                        sideCounter = 0;
                    }

                }

                if (val3 < 56)
                {
                    holder3 = 50;
                }
                if (val3 > 71)
                {
                    holder3 = 0;
                }


                if (val < 30)
                {
                    holder = 0.00M;
                }
                if (val > 38)
                {
                    holder = 50.00M;
                }
                if (val2 < 21)
                {
                    holder2 = 0.00M;
                }
                if (val2 > 35)
                {
                    holder2 = 50.00M;
                }

                scores = holder + holder2 + holder3;
                scores = 160 - scores;

                int min1 = 1;
                int min2 = 4;
                int sec1 = 3;
                int sec2 = 1;
                string a = "{0}{1}{2}{3}";
                string[] numbers = new string[57];
                for (int i = 0; i < 57; i++)
                {
                    numbers[i] = string.Format(a, min1, min2, sec1, sec2);

                    sec2 = sec2 - 1;
                    if (sec2 == -1)
                    {
                        sec2 = 9;
                        sec1 = sec1 - 1;
                    }
                    if (sec1 == -1)
                    {
                        sec1 = 5;
                        min2 = min2 - 1;
                    }
                    //Console.WriteLine(numbers[i]);


                }


                decimal points = 30;
                decimal points2 = 30.357M;

                {

                    if (scores <= 30)
                    {
                        Label12.Text = scores.ToString();
                        Label13.Text = "1431";
                        SqlConnection conns = new SqlConnection(ConfigurationManager.ConnectionStrings["TestDBConnectionString1"].ConnectionString);
                        SqlCommand cmd = new SqlCommand("UPDATE bleaTest SET rTimeN = @rTimeN WHERE (Id = @Id)", conns);
                        cmd.CommandType = CommandType.Text;
                        Label IdL = ((Label)FormView1.FindControl("IdLabel"));
                        cmd.Parameters.AddWithValue("@Id", IdL.Text);
                        cmd.Parameters.AddWithValue("@rTimeN", Label13.Text);
                        conns.Open();
                        cmd.ExecuteNonQuery();

                    }
                    if (scores > 40)
                    {
                        Label12.Text = "Failed";
                        Label13.Text = "Failed";

                        SqlConnection conns = new SqlConnection(ConfigurationManager.ConnectionStrings["TestDBConnectionString1"].ConnectionString);
                        SqlCommand cmd = new SqlCommand("UPDATE bleaTest SET rTimeN = @rTimeN WHERE (Id = @Id)", conns);
                        cmd.CommandType = CommandType.Text;
                        Label IdL = ((Label)FormView1.FindControl("IdLabel"));
                        cmd.Parameters.AddWithValue("@Id", IdL.Text);
                        cmd.Parameters.AddWithValue("@rTimeN", Label13.Text);
                        conns.Open();
                        cmd.ExecuteNonQuery();


                    }
                    for (int i = 0; i < miles.Length; i++)
                    {

                        if (scores > points && scores < points2)
                        {
                            Label12.Text = scores.ToString();
                            Label13.Text = numbers[i];
                            SqlConnection conns = new SqlConnection(ConfigurationManager.ConnectionStrings["TestDBConnectionString1"].ConnectionString);
                            SqlCommand cmd = new SqlCommand("UPDATE bleaTest SET rTimeN = @rTimeN WHERE (Id = @Id)", conns);
                            cmd.CommandType = CommandType.Text;
                            Label IdL = ((Label)FormView1.FindControl("IdLabel"));
                            cmd.Parameters.AddWithValue("@Id", IdL.Text);
                            cmd.Parameters.AddWithValue("@rTimeN", Label13.Text);
                            conns.Open();
                            cmd.ExecuteNonQuery();

                        }
                        points = points + .357M;
                        points2 = points2 + .357M;


                    }
                }


                Label16.Text = scores.ToString();


            }
        }




    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:25:51+00:00Added an answer on June 14, 2026 at 11:25 am

    I messed around with some code in the DropDownList1_SelectedIndexChange method and also changed my FormView1 EnableViewState="False"

    Here’s the code for DropDownList1_SelectedIndexChange:

     protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
     {
         if (DropDownList1.SelectedValue != "0")
         {
             FormView2.DataBind();
             Label12.Text = "";
             Label13.Text = "";
    
             Button2_Click(sender, e);
             Button5.Visible = true;
             Label19.Visible = false;
             UpdatePanel4.Visible = true;
         }
         else
         {
             UpdatePanel4.Visible = false;
             Button5.Visible = false;
             Label19.Visible = true;
         }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.