ASP.NET 3.5 and above only

Obout.Ajax.UI Controls - HTML Editor - Content in database

Get/set content of the Editor you can in the Load event handler of the Page.

void Page_Load(object o, EventArgs e){
  OleDbConnection Connection  = new OleDbConnection();
  Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
                                                +Page.Server.MapPath("database/db.mdb") + ";";
  Connection.Open();

  if(Page.IsPostBack){
    OleDbCommand myCommand;
    string sqlString="Update tbTest Set fldContent=? Where id=?";
    myCommand=new OleDbCommand(sqlString,Connection);

    myCommand.Parameters.Add(new OleDbParameter("@fldContent",OleDbType.VarChar));
    myCommand.Parameters["@fldContent"].Value=editor.Content;  // save Editor content
    myCommand.Parameters.Add(new OleDbParameter("@id",OleDbType.Integer));
    myCommand.Parameters["@id"].Value = 1;

    myCommand.ExecuteNonQuery();
  }
  else
  {
    string sqlString="Select fldContent from tbTest Where id=1";
    OleDbDataAdapter eAdapter=new OleDbDataAdapter(sqlString,Connection);
    DataTable eTable = new DataTable();
    OleDbCommandBuilder CommandBuilder = new OleDbCommandBuilder(eAdapter);

    eAdapter.Fill(eTable);
    editor.Content=(string)eTable.Rows[0][0]; // set Editor content

    eAdapter.Dispose();
    eTable.Dispose();
  }
  Connection.Close();
  Connection.Dispose();
}

"YOU ARE THE BEST! The first time in my life I've met with such excellent team. Almost instant reply! That's amazing! Thank You Very Much!"

Arsen Memetov
San Computer Antalya, Turkey

Random testimonial   All testimonials