Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

ASP.NET post textbox after button click

$
0
0
So im just using an ASP.NET atm

Iv added 4 textboxes from the toolbox TextBox1, TextBox2, TextBox3, TextBox 4 and a button 'button1'

I want the user to enter data into the textboxs, compare them by .length and produce the output in order.

So before ordering them I am just trying to display them in the order of boxes textbox1, textbox2, textbox3.

protected void Button1_Click(object sender, EventArgs e)
    {
        DatesInOrderTextBox.Text = "Dates in order are" + TextBox1 + ", " + TextBox2 + ", " + TextBox3;
}



After that I intend to do something like the following

        //date 1 is biggest
        if (date1.Length > date2.Length && date1.Length > date3.Length)
        {
            //date 2 is 2nd & date 3 is 3rd
            if (date2.Length > date3.Length)
            {
                FirstDateOrder = date1;
                SecondDateOrder = date2;
                ThirdDateOrder = date3;

              System.Windows.Forms.MessageBox.Show("Order is 1, 2, 3");

             //   System.Windows.Forms.MessageBox.Show("Order is:" + FirstDateOrder + ", " + SecondDateOrder + ", " + ThirdDateOrder);

                ViewBag.DateOrder = "Order is 1,2,3";

                return RedirectToAction("Index");
            }

            //date 3 is 2nd & date 2 is 3rd
            else
            {
                FirstDateOrder = date1;
                SecondDateOrder = date3;
                ThirdDateOrder = date2;

                System.Windows.Forms.MessageBox.Show("Order is 1, 3, 2");

                return RedirectToAction("Index");
            }
}


Although when I click the button textbox4 is displaying

Dates in order areSystem.Web.UI.WebControls.TextBox, System.Web.UI.WebControls.TextBox, System.Web.UI.WebControls.TextBox



prob something simple just dont know how to fix it...thank you guys

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>