trewyn15
New Member
Hey guys, I have some more problems here 
Working on an ASP.net project, having trouble calculating information out of my ListBox and getting issues with the location of my script.
Here is what I have so far for my code:
and here is what's being asked of me:
1. Display the cost of all air seats in a ListBox
2. Click the COMPUTE COST button to show the total cost of all seats in a Label.
3. 3. Read the DBSAMPLE.mdb Access database , Airplane – Seat Locations data table using a web config file
So all of the air seats are being pulled from the DBSAMPLE database file and displayed in the listbox, I have those displaying fine, but I am having a hard time understanding how I can take those and put them into an equation to get the total cost of all the seats and display that number in the label that I have already created.
#3 also, I just don't understand what's being asked there lol
Any help is appreciated a usual!

Working on an ASP.net project, having trouble calculating information out of my ListBox and getting issues with the location of my script.
Here is what I have so far for my code:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void btnButton1_Click(object sender, EventArgs e)
{
foreach (ListItem item in ListBox1.Items)
Label1.Text="Text Output";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Lab 7</title>
</head>
<body>
<form id="form1" runat="server">
<asp:SqlDataSource id="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\MyDocs\Desktop\DBSAMPLE.mdb" ProviderName="System.Data.OleDb" SelectCommand="SELECT [TicketPrice] FROM [Airplane - Seat Locations]">
</asp:SqlDataSource>
<br />
<asp:ListBox id="ListBox1" runat="server" DataSourceID="SqlDataSource1" DataTextField="TicketPrice" DataValueField="TicketPrice">
</asp:ListBox>
<br />
<asp:Button id="btnButton1" runat="server" Text="COMPUTE COST" OnClick="Button1_Click" />
<br />
<br />
<asp:Label id="Label1" runat="server" Text="Label"></asp:Label>
</form>
</body>
</html>
and here is what's being asked of me:
1. Display the cost of all air seats in a ListBox
2. Click the COMPUTE COST button to show the total cost of all seats in a Label.
3. 3. Read the DBSAMPLE.mdb Access database , Airplane – Seat Locations data table using a web config file
So all of the air seats are being pulled from the DBSAMPLE database file and displayed in the listbox, I have those displaying fine, but I am having a hard time understanding how I can take those and put them into an equation to get the total cost of all the seats and display that number in the label that I have already created.
#3 also, I just don't understand what's being asked there lol
Any help is appreciated a usual!