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();
}

"Thanks much. The trees seem to be working exactly as we want and we do appreciate the timely resolution. As our project moves further along the design process, we find ourselves utilizing Obout controls more and more and it's comforting to know that your support system is so responsive."

Kevin Holder
Tennessee Department of Human Services

Random testimonial   All testimonials