Exemplo n.º 1
0
    protected void gvFAQ_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }
        FAQItem.FlushFAQCache();
        Controls_mfbHtmlEdit t = (Controls_mfbHtmlEdit)gvFAQ.Rows[e.RowIndex].FindControl("txtAnswer");

        sqlFAQ.UpdateParameters["Answer"] = new Parameter("Answer", System.Data.DbType.String, t.FixedHtml);
    }
Exemplo n.º 2
0
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        DBHelper dbh = new DBHelper("INSERT INTO FAQ SET Category=?Category, Question=?Question, Answer=?Answer");

        if (dbh.DoNonQuery((comm) =>
        {
            comm.Parameters.AddWithValue("Category", txtCategory.Text);
            comm.Parameters.AddWithValue("Question", txtQuestion.Text);
            comm.Parameters.AddWithValue("Answer", txtAnswer.Text);
        }))
        {
            FAQItem.FlushFAQCache();
            txtCategory.Text = txtQuestion.Text = txtAnswer.Text = string.Empty;
            gvFAQ.DataBind();
        }
    }