protected void btn_project3_marks_save_Click(object sender, EventArgs e) { int n = 0; string[] marks = new string[a]; for (int s = 0; s < a; s++) { string t = n.ToString(); TextBox tx1 = (TextBox)Table1.FindControl("tx" + s.ToString()); if (tx1.Text == null) { marks[s] = "0"; } else { marks[s] = tx1.Text; } string t_id = Session["t_id"].ToString(); string su_id = Session["teachersubject_id"].ToString(); con.Open(); MySqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "update subject_result set p3='" + marks[s] + "',total_p3_marks='" + Total_p3_marks.Text + "' where srs_id =(Select srs_id from student_registered_courses where su_id='" + su_id + "' limit " + t + ",1)"; cmd.ExecuteNonQuery(); con.Close(); n = n + 1; } btn_project3_marks_save.Text = "Edit"; }
protected void edit_Click(object sender, EventArgs e) { FileUpload f = (FileUpload)Table1.FindControl("FileUpload1"); String path = Server.MapPath("~/Web/images/"); f.PostedFile.SaveAs(path + f.FileName); category danhmuc = new category(); danhmuc.category_id = int.Parse(categoryId.Text); danhmuc.category_name = categoryName.Text; danhmuc.image = f.FileName; data.suaCategory(danhmuc); }
protected void edit_Click(object sender, EventArgs e) { FileUpload f = (FileUpload)Table1.FindControl("FileUpload1"); String path = Server.MapPath("~/Web/images/"); f.PostedFile.SaveAs(path + f.FileName); product product = new product(); product.product_id = int.Parse(productId.Text); product.product_name = tendienthoai.Text; product.price = int.Parse(giadienthoai.Text); product.descriptions = mota.Text; product.category_id = int.Parse(dsHangDienThoai.SelectedValue); product.image = f.FileName; data.suaProduct(product); }
void MergeBTN_Click(object sender, EventArgs e) { foreach (string id in createdckbxs) { CheckBox myControl1 = (CheckBox)Table1.FindControl(id); if (myControl1 != null) { if (myControl1.Checked == true) { CheckedCheckboxes.Add(id); } } else { Response.Redirect("errorpage.aspx?id=003"); } } }
void addtocartbutton_Click(Object sender, EventArgs e) { // Capture the order into Hashtable Button clickedButton = (Button)sender; TextBox textBox_order = (TextBox)Table1.FindControl(clickedButton.CommandArgument); // Retrieve item id from mdb->items // Note here that the textbox was named after the item name. // See comments inside DisplayItems(Hashtable items) // and createButton(string textToShow, string commandArg) string item_id = dbm.GetItemID(textBox_order.ID).ToString(); // Retrieve customer id from mdb->customers string customer_id = dbm.GetCustomerID((string)Session["Username"]).ToString(); // Store itemid, customerid, qtyordered into mdb->cart // In real application, you should also handle the case where item is out-of-stock string order_number = (string)Session["OrderNumber"]; dbm.StoreOrderToCart(order_number, item_id, customer_id, textBox_order.Text); }