protected void Submit_click(object sender, EventArgs e) { con.Open(); //SqlCommand cmd = new SqlCommand("add_review_proc",con); //cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.AddWithValue("@action", "insert"); //cmd.Parameters.AddWithValue("@pk_id", ""); //cmd.Parameters.AddWithValue("@father_name", Session["prnt_name"].ToString()); //cmd.Parameters.AddWithValue("@student_name", student_ddl.SelectedItem.ToString()); //cmd.Parameters.AddWithValue("@roll_no", text_roll.Text); //cmd.Parameters.AddWithValue("@class", text_class.Text); //cmd.Parameters.AddWithValue("@section", Text_section.Text); //cmd.Parameters.AddWithValue("@complaint", TextBox1.Text); //cmd.ExecuteNonQuery(); parents.parentservice obj = new parents.parentservice(); int a = obj.insert(Session["prnt_name"].ToString(), student_ddl.SelectedItem.ToString(), text_roll.Text, text_class.Text, Text_section.Text, TextBox1.Text); if (a > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Complaints/Review Sent Successfully!!!!');", true); gridshow(); blank(); } con.Close(); }
protected void upd_btn_Click(object sender, EventArgs e) { con.Open(); //SqlCommand cmd = new SqlCommand("add_review_proc", con); //cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.AddWithValue("@action", "update"); //cmd.Parameters.AddWithValue("@pk_id", Label_id.Text); //cmd.Parameters.AddWithValue("@father_name", Text_Father.Text); //cmd.Parameters.AddWithValue("@student_name", student_ddl.SelectedItem.ToString()); //cmd.Parameters.AddWithValue("@roll_no", text_roll.Text); //cmd.Parameters.AddWithValue("@class", text_class.Text); //cmd.Parameters.AddWithValue("@section", Text_section.Text); //cmd.Parameters.AddWithValue("@complaint", TextBox1.Text); //cmd.ExecuteNonQuery(); parents.parentservice obj = new parents.parentservice(); int a = obj.update(Convert.ToInt32(Label_id.Text), Text_Father.Text, student_ddl.SelectedItem.ToString(), text_roll.Text, text_class.Text, Text_section.Text, TextBox1.Text); if (a > 0) { gridshow(); blank(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Updated!!!!');", true); submit_btn.Visible = true; upd_btn.Visible = false; } con.Close(); }
public void gridshow() { //SqlDataAdapter da = new SqlDataAdapter("add_review_dlt_proc", con); //da.SelectCommand.CommandType = CommandType.StoredProcedure; //da.SelectCommand.Parameters.AddWithValue("@action", "show"); //da.SelectCommand.Parameters.AddWithValue("@pk_id", ""); //DataTable dt = new DataTable(); //da.Fill(dt); parents.parentservice obj = new parents.parentservice(); GridView1.DataSource = obj.show(); GridView1.DataBind(); }
protected void btn_delete_Click(object sender, EventArgs e) { con.Open(); LinkButton lnk = (LinkButton)sender; GridViewRow row = (GridViewRow)lnk.NamingContainer; Label l1 = (Label)row.FindControl("Lbl_id"); //SqlCommand cmd = new SqlCommand("add_review_dlt_proc", con); //cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.AddWithValue("@action", "delete"); //cmd.Parameters.AddWithValue("@pk_id", l1.Text); //cmd.ExecuteNonQuery(); parents.parentservice obj = new parents.parentservice(); int a = obj.delete(Convert.ToInt32(l1.Text)); { gridshow(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "test", "alert('Data Deleted!!!!');", true); } con.Close(); }