protected void btn_Click(object sender, EventArgs e)
 {
     if (dB.IUD("INSERT INTO Tbl_Discuss (Student_id, Question,Ans_count) VALUES('" + userlbl.Text + "','" + txtques.Text + "',0)") == true)
     {
         infoMsg.Text = "Your query is posted succesfully";
     }
     else
     {
         infoMsg.Text = "Your query could not be posted, Please Try later";
     }
 }
Exemple #2
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile == true)
        {
            string fname, q;
            fname = FileUpload1.FileName;
            string category = DropDownList1.SelectedItem.Text;
            if (category == "Web Technology")
            {
                FileUpload1.SaveAs(MapPath("~/MATERIAL/Web Technology/" + fname));
            }
            else if (category == "Computer Organisation And Architecture")
            {
                FileUpload1.SaveAs(MapPath("~/MATERIAL/Computer Organisation And Architecture/" + fname));
            }
            else if (category == "Programming")
            {
                FileUpload1.SaveAs(MapPath("~/MATERIAL/Programming/" + fname));
            }
            else if (category == "Database")
            {
                FileUpload1.SaveAs(MapPath("~/MATERIAL/Database/" + fname));
            }
            else if (category == "Fundamental of Computers")
            {
                FileUpload1.SaveAs(MapPath("~/MATERIAL/Fundamental of Computers/" + fname));
            }
            else if (category == "Operating System")
            {
                FileUpload1.SaveAs(MapPath("~/MATERIAL/Operating System/" + fname));
            }


            q = "insert into tbl_UploadMaterial values('" + txtSubjectName.Text + "','" + fname + "','" + category + "','" + DateTime.Now + "')";
            DBAdmin dm = new DBAdmin();
            bool    j  = dm.IUD(q);
            if (j == true)
            {
                GridView1.DataSource = db.ReadBulkData("select * from tbl_UploadMaterial");
                GridView1.DataBind();
                //jaise hi upload ho waise hi show ho jaye...
                Response.Write("<script>alert('Study Material uploaded successfully')</script>");
            }
        }
        txtSubjectName.Text = "";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string q;

        q = "insert into tbl_enquiry values('" + txtName.Text + "','" + txtemail.Text + "','" + txtcontact.Text + "','" + txtMessage.Text + "','" + DateTime.Now + "')";

        DBAdmin dm = new DBAdmin();
        bool    j  = dm.IUD(q);

        if (j == true)
        {
            Response.Write("<script>alert('Enquiry Submitted')</script>");
        }
        else
        {
            Response.Write("<script>alert('Enquiry Not Submitted')</script>");
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        try
        {
            Button      btnRespond = (Button)(sender);
            GridViewRow gRow       = (GridViewRow)(btnRespond.Parent.Parent);
            Enquiryid.Text = gRow.Cells[1].Text;
            string q;
            q = "delete from tbl_enquiry where Enquiry_id='" + Enquiryid.Text + "'";

            DBAdmin dm = new DBAdmin();
            dm.IUD(q);
            DataTable dt = new DataTable();
            dt = dm.ReadBulkData("select * from tbl_enquiry");
            if (dt.Rows.Count > 0)
            {
                GridView2.DataSource = dt;
                GridView2.DataBind();
            }
        }
        catch (Exception ex)
        {
        }
    }