protected void SeeDetail(object sender, EventArgs e) { try { Button btn = (Button)(sender); pID = Convert.ToInt32(btn.CommandArgument); // test CommandArgument Details SeeDetails = new Details(pID, desc, picURL); ConnectClass.seeDetails(SeeDetails); detailView.Text = SeeDetails.Description; productPic.ImageUrl = SeeDetails.pictureURL; } catch { detailView.Text = "Failed!"; } }
protected void Write(object sender, EventArgs e) { try { uName = usernamelbl.Text; itemName = itemList.SelectedItem.Text; itemComment = commenttxt.Text; itemGrade = Convert.ToInt32(grade.SelectedItem.Text); Comment writeComment = new Comment(uName, itemName, itemComment, itemGrade); ConnectClass.writeComment(writeComment); //string msg = "Register Successfully!"; //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SomeKey", "alert('Some alert')", true); //Response.Write("<script>alert('" + msg + "')</script>"); //Response.Redirect("login.aspx"); Response.Write("<script type='text/javascript'>"); Response.Write("alert('Thank you very much for your comment! ');"); Response.Write("</script>"); commentView(); /*SqlConnection con = new SqlConnection(connStr); * con.Open(); * string sQry = "select FName,PName,PCmt,grade from dbo.Comment"; * SqlCommand cmd = new SqlCommand(sQry, con); * * SqlDataAdapter da = new SqlDataAdapter(cmd); * DataTable dt = new DataTable(); * DataSet ds = new DataSet(); * da.Fill(dt); * con.Close(); * ds.Tables.Add(dt); * DisplayComment.DataSource = ds.Tables[0]; * DisplayComment.DataBind();*/ } catch { result1.Text = "writing Failed!"; } }
protected void check_Click(object sender, EventArgs e) { firstname = fName.Text; lastname = lName.Text; email = eMail.Text; password = pWord.Text; Info infoCheck = new Info(firstname, lastname, email, password); ConnectClass.checkInfo(infoCheck); //string msg = "Register Successfully!"; //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SomeKey", "alert('Some alert')", true); //Response.Write("<script>alert('" + msg + "')</script>"); //Response.Redirect("login.aspx"); if (infoCheck.eMailAddress == "already exist") { Response.Write("<script type='text/javascript'>"); Response.Write("alert('Please use other email');"); //Response.Write("document.location.href='login.aspx';"); Response.Write("</script>"); } else { try { Info infoRegister = new Info(firstname, lastname, email, password); ConnectClass.registerInfo(infoRegister); Response.Write("<script type='text/javascript'>"); Response.Write("alert('Register Success! ');"); //Response.Write("document.location.href='login.aspx';"); Response.Write("</script>"); } catch { result.Text = "Register Failed!"; } } }
protected void SeeAVG(object sender, EventArgs e) { try { Label AVG = (Label)(sender); pName = AVG.Text; Details SeeDetails = new Details(pID, desc, picURL); ConnectClass.seeDetails(SeeDetails); detailView.Text = SeeDetails.Description; productPic.ImageUrl = SeeDetails.pictureURL; } catch { detailView.Text = "Failed!"; } }