TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
selvi subramanian
NA
799
571.8k
to add and multiply textbox and to again add and multiply
Aug 21 2013 1:13 AM
my code is
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class Admin_Default : System.Web.UI.Page
{
REMO sel = new REMO();
DataSet ds = new DataSet();
string s = ConfigurationManager.AppSettings["RM"].ToString();
SqlConnection cn = new SqlConnection();
SqlCommand cd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
public int se;
public float sl;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
prr();
sno();
pqice();
txtdate.Text = System.DateTime.Now.ToShortDateString();
}
}
private void sno()
{
// int z = 0;
//ListItem cb = new ListItem();
// ds = sel.GETDS("select Billno from numbeer");
ds = sel.GETDS("select min (Billno) as Billno from numbeer where status='view'");
foreach (DataRow dr in ds.Tables[0].Rows)
{
//ListItem sw = new ListItem();
txtbillno.Text = dr["Billno"].ToString();
//sw.Value = Convert.ToString(z + 1);
}
}
private void pqice()
{
ListItem lik = new ListItem();
// lik.Text = "Select";
DropDownList3.Items.Insert(0, new ListItem("--Select--", "0"));
lik.Value = "0";
for (int se = 1; se <= 700; se++)
{
DropDownList3.Items.Add(Convert.ToString(se));
}
}
private void prr()
{
int s = 0;
ListItem lim = new ListItem();
//lim.Text = "Select";
//lim.Value = "0";
DropDownList1.Items.Add(lim.ToString());
ds = sel.GETDS("select DISTINCT name from demo");
DropDownList1.Items.Insert(0, new ListItem("--Select--", "0"));
foreach (DataRow dr in ds.Tables[0].Rows)
{
ListItem ss = new ListItem();
lim.Text = dr["name"].ToString();
lim.Value = Convert.ToString(s + 1);
DropDownList1.Items.Add(lim.ToString());
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList2.Items.Clear();
DataSet ds = new DataSet();
string qr = "select weight from demo where name='" + DropDownList1.SelectedValue.ToString() + "'";
ds = sel.GETDS(qr);
ListItem se = new ListItem();
//se.Value = "0";
//se.Text = "Select";
DropDownList2.Items.Insert(0, new ListItem("--Select--", "0"));
foreach (DataRow dr in ds.Tables[0].Rows)
{
ListItem liz = new ListItem();
//liz.Text = "Select";
liz.Value = dr["weight"].ToString();
DropDownList2.Items.Add(liz.ToString());
}
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
ListItem sss = new ListItem();
// sss.Text = "Select";
DropDownList2.Items.Insert(0, new ListItem("--Select--", "0"));
DataSet ds = new DataSet();
string sq = "select price from demo where weight='" + DropDownList2.SelectedItem.ToString() + "'";
ds = sel.GETDS(sq);
TextBox1.Text = ds.Tables[0].Rows[0]["price"].ToString();
foreach (DataRow dr in ds.Tables[0].Rows)
{
TextBox1.Text = dr["price"].ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
//string qrt = "insert into cement (Date,BillNo,CustomerName,Address,ProductName,Quantity,Price,Extra) values ('" + txtdate.Text;
//qrt += "','" + txtbillno.Text;
//qrt += "','" + txtcn.Text;
//qrt += "','" + txtad.Text;
//qrt += "','" + DropDownList1.SelectedItem.ToString();
//qrt += "','" + DropDownList2.SelectedItem.ToString();
//qrt += "','" + TextBox1.Text;
//// qrt += "','" + ddprice.SelectedItem.ToString();
//qrt += "','" + txtex.Text;
//qrt += "')";
//sel.Insert(qrt);
//Label10.Visible = true;
//Label10.Text = "Sucess";
//cn = new SqlConnection(s);
//cn.Open();
//string qrs = "insert into product (date,Product,BillNo,ProductName,Quantity,Price,Extra) values ('" + txtdate.Text;
//qrs += "','" + TextBox2.Text;
//qrs += "','" + txtbillno.Text;
////sqrs += "','" + txtcn.Text;
//qrs += "','" + DropDownList1.SelectedItem.ToString();
//qrs += "','" + DropDownList2.SelectedItem.ToString();
//qrs += "','" + TextBox1.Text;
////qrs += "','" + ddprice.SelectedItem.ToString();
//qrs += "','" + txtex.Text;
//qrs += "')";
////sel.Insert(qrs);
//cd = new SqlCommand(qrs, cn);
//cd.ExecuteNonQuery();
//cn.Close();
string up = "update numbeer set status='Viewed' where Billno='" + txtbillno.Text + "'";
sel.Insert(up);
}
protected void Button2_Click(object sender, EventArgs e)
{
txtbillno.Text = "";
txtcn.Text = "";
txtad.Text = "";
DropDownList1.SelectedValue = "Select";
//DropDownList2.SelectedValue = "Select";
TextBox1.Text = "";
txtex.Text = "";
}
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
//txttp.Text ="sum:"+(Convert.ToInt32(DropDownList3.SelectedValue) + Convert.ToInt32(TextBox1.Text));
float sl =(Convert.ToInt32(DropDownList3.Text)* Convert.ToInt32(TextBox1.Text));
txttp.Text = Convert.ToString(sl);
TextBox6.Text = (int.Parse(txttp.Text) * (14.5 / 100)).ToString();
}
protected void txtvat_TextChanged(object sender, EventArgs e)
{
float amm=(float.Parse(txttp.Text)+float.Parse(txtvat.Text));
TextBox3.Text = Convert.ToString(amm);
double guna = int.Parse(TextBox3.Text) * (14.5 / 100);
TextBox4.Text = Convert.ToString(guna);
TextBox5.Text = (amm + guna).ToString();
// TextBox7.Text = (sl + TextBox6.Text);
float amman = (sl+ float.Parse(TextBox6.Text));
TextBox7.Text = Convert.ToString(amman);
}
protected void TextBox4_TextChanged(object sender, EventArgs e)
{
float sgs = int.Parse(TextBox3.Text) + int.Parse(TextBox4.Text);
TextBox5.Text = Convert.ToString(sgs);
}
}
my design is
<table class="style2" align="center" style="border-color: #1d599e; border-style: outset;
border-width: thin; background-color: #D7D7D7; width:50%" >
<tr>
<td style="margin-left: 80px; background:#1d599e;" align="center" colspan="2">
BILLING DETAILS
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label1" runat="server" Text="Product" Visible="false"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" Visible="false" Text="Cement"></asp:TextBox>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label2" runat="server" Text="Date"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtdate" runat="server"></asp:TextBox>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label3" runat="server" Text="BillNo"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbillno" runat="server"
></asp:TextBox>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label4" runat="server" Text="Customer Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcn" runat="server" ></asp:TextBox>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label5" runat="server" Text="Address"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtad" runat="server"></asp:TextBox>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label6" runat="server" Text="Brand Name"></asp:Label> </td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged" Width="146px">
</asp:DropDownList>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label7" runat="server" Text="Quantity"></asp:Label> </td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList2_SelectedIndexChanged" Height="16px"
Width="146px">
<%--<asp:ListItem>Select</asp:ListItem>--%>
</asp:DropDownList>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label8" runat="server" Text="Product Price"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label11" runat="server" Text="Required No"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="true"
onselectedindexchanged="DropDownList3_SelectedIndexChanged" Width="149px" onhange="return GetTotal()" >
</asp:DropDownList>
<asp:Label ID="Label14" runat="server" Visible="False"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label12" runat="server" Text="Price"></asp:Label>
</td>
<td>
<asp:TextBox ID="txttp" runat="server" AutoPostBack="true"
ontextchanged="txttp_TextChanged" ></asp:TextBox>
<asp:TextBox ID="TextBox6" runat="server" ontextchanged="TextBox6_TextChanged" AutoPostBack="true"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label13" runat="server" Text="Extra"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtvat" runat="server" ontextchanged="txtvat_TextChanged" AutoPostBack="true" ></asp:TextBox>
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Actual price</td>
<td>
<asp:TextBox ID="TextBox3" runat="server" ontextchanged="TextBox3_TextChanged" AutoPostBack="true" ></asp:TextBox>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label9" runat="server" Text="VAT"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtex" runat="server"
AutoPostBack="true" Text="(14.5/100)" ReadOnly="True" ></asp:TextBox>
<asp:TextBox ID="TextBox4" runat="server" AutoPostBack="True"
ontextchanged="TextBox4_TextChanged" Visible="False"></asp:TextBox>
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label15" runat="server" Text="Total Amount"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" />
<asp:Label ID="Label10" runat="server" Text=""></asp:Label>
<asp:Button ID="Button2" runat="server" Text="clear" onclick="Button2_Click" />
</td>
</tr>
</table>
Reply
Answers (
1
)
Problem in retrieving email of registered user
how to create .edmx in my project