Write a program to Calculate Total amount of a particular product purchased by customers.
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left:40px; height: 235px;">
<br />
Product : -
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>ICE-Cream</asp:ListItem>
</asp:DropDownList>
<br />
<br />
Price : -
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>20</asp:ListItem>
</asp:DropDownList>
<br />
<br />
Quantity : -<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Total" onclick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
********HTML***************
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="margin-left:40px; height: 235px;">
<br />
Product : -
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>ICE-Cream</asp:ListItem>
</asp:DropDownList>
<br />
<br />
Price : -
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>20</asp:ListItem>
</asp:DropDownList>
<br />
<br />
Quantity : -<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Total" onclick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
********C# Code***************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Product_of_Item : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Total is :-"+Convert.ToInt32(TextBox1.Text) * Convert.ToInt32(DropDownList2.SelectedValue);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Product_of_Item : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Total is :-"+Convert.ToInt32(TextBox1.Text) * Convert.ToInt32(DropDownList2.SelectedValue);
}
}

No comments:
Post a Comment