|
New Coder
Join Date: Jun 2012
Posts: 24
Thanks: 2
Thanked 0 Times in 0 Posts
|
Hello Old Pedant, thanks for your reply! I have attached a capture of the page. In terms of your silly question, I do not know how to merge a single ASP page with the existing project. When I try to import the HTML and CSS in VS, the layout is not accommodating (fubar). Briefly, dropbox values are selected and when the calculate button is clicked it references a multidimensional array to produce the value in label6.Text. Below is the C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace fluriousWeb
{
public partial class WebForm1 : System.Web.UI.Page
{
int[,] stChips = new int[,] {{2,3,5,6,8,10},
{3,6,10,13,16,19},
{5,10,15,19,24,29},
{6,13,19,26,32,39},
{8,16,24,32,40,49},
{10,19,29,39,49,58},
{11,23,34,45,57,68},
{13,26,39,52,65,78},
{15,29,44,58,73,87},
{16,32,49,65,81,97},
{32,65,97,129,162,194},
{49,97,146,194,243,291},
{65,129,194,259,323,388},
{81,162,243,323,404,485}};
int[,] stPavers = new int[,]{{2,3,5,7},
{3,7,10,13},
{5,10,15,20},
{7,13,20,27},
{12,23,35,47}};
protected void Page_Load(object sender, EventArgs e)
{}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex != -1)
{
Label1.Visible = true;
Label3.Visible = true;
Label2.Visible = false;
Label4.Visible = false;
DropDownList1.Visible = false;
DropDownList3.Visible = false;
DropDownList2.Visible = true;
DropDownList4.Visible = true;
Label6.Text = "";
}
if (RadioButtonList1.SelectedIndex == 1)
{
Label1.Visible = false;
Label3.Visible = false;
Label2.Visible = true;
Label4.Visible = true;
DropDownList2.Visible = false;
DropDownList4.Visible = false;
DropDownList1.Visible = true;
DropDownList3.Visible = true;
Label6.Text = "";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Label6.Text = "";
DropDownList1.Visible = false;
DropDownList3.Visible = false;
DropDownList2.Visible = false;
DropDownList4.Visible = false;
Label1.Visible = false;
Label3.Visible = false;
Label2.Visible = false;
Label4.Visible = false;
RadioButtonList1.SelectedIndex = -1;
}
protected void Button2_Click(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex != -1)
{
int stoneInch = DropDownList2.SelectedIndex;
int stoneSq = DropDownList4.SelectedIndex;
if (stoneInch != -1 && stoneSq != -1)
Label6.Text = stChips[stoneInch, stoneSq].ToString();
}
if (RadioButtonList1.SelectedIndex == 1)
{
int paverInch = DropDownList1.SelectedIndex;
int paverSq = DropDownList3.SelectedIndex;
if (paverInch != -1 && paverSq != -1)
{
Label6.Text = stPavers[paverInch, paverSq].ToString();
}
}
}
}
}
|