English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How do you do this in ASP.NET/VB.net

2006-07-22 13:37:12 · 3 answers · asked by crazmeka 1 in Computers & Internet Programming & Design

When the visitor clicks the Submit button, calculate the price by using the formula: quantity multiplied by the cost of the item. Display the total cost to the user

How do I this in ASP.NET/VB.NET

2006-07-22 13:45:09 · update #1

3 answers

Int32 eqid;
eqid = Convert.ToInt32(Request.QueryString["eid"]);
HttpCookie ck = Request.Cookies["id"];
String st;
st = "select * from TbEqp where EqpCod=" + Convert.ToInt32(ck.Value);
SqlDataAdapter adp = new SqlDataAdapter(st, ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
DataSet ds = new DataSet();
adp.Fill(ds);
DataRowView r1;
r1 = ds.Tables[0].DefaultView[0];

tbtemp = (DataTable)(Session["abc"]);
DataRow r;
r = tbtemp.NewRow();
r[1] = ds.Tables[0].Rows[0]["EqpCod"];
r[2] = ds.Tables[0].Rows[0]["EqpNam"].ToString();
r[3] = ds.Tables[0].Rows[0]["EqpRat"];
r[4] = 1;
int a, b,c;
a = Convert.ToInt32(r[3]);
b = Convert.ToInt32(r[4]);
c= a* b;
r[5] = c;
tbtemp.Rows.Add(r);
GridView1.DataSource = tbtemp;
GridView1.DataBind();
TextBox1.Text = tbtemp.Compute("sum(TAmt)", null).ToString();
}
I have used this code.U can modify it accordingly.
Hope it helps u.

2006-07-23 04:23:59 · answer #1 · answered by Friend 2 · 0 0

In the ASP model (php model too) you post (submit) to another page by passing it all the variables, or an array, from the first page. On the 2nd page you'll figure out what they entered, do the math, get an overall total figure going. Once you've done all the math then format the page with your html, and put your total where you want, etc.

You may be thinking of local javascript. You can set up an on-click rule for a button where the js will add up your stuff and print a total. There are lots of java script sites with free scripts. Search around those to see what you find and learn. You'll certainly have to modify your script to your page and needs, but how much fun will that be?

That ought to get you coding.

(and yes, php is awesome, but there's nothing wrong with asp, .net or any of those)

2006-07-22 23:55:06 · answer #2 · answered by stljazzycat 1 · 0 0

Those are junk . learn PHP.

2006-07-22 21:53:11 · answer #3 · answered by SEOplanNOW.com 7 · 0 0

fedest.com, questions and answers