Click here to Skip to main content
15,889,403 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am facing problem with FCKeditor is that, when i type some data then jquery call SaveData function and store data successfuly... but when i paste data from any word document/excel sheet/ any other document then jquery does not call the SaveData function and data is not saved in database..
my JQuery code is
$("#btnSave").click(function () {
      debugger;
      var datatosave = $.fck.content('fck1', '');
      $.ajax({
          type: 'POST',
          url: 'Default.aspx/SaveData',
          data: "{ 'dataToSave': ' " + datatosave + "'}",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function () {
              alert("Data Saved successfuly");
              $("#fckDiv").slideUp("slow");
          }
      });
  });


my aspx.cs file code is
[WebMethod]
public static void SaveData(string dataToSave)
{
   SqlConnection con;
   string connectionstring = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
   using (con = new SqlConnection(connectionstring))
   {
         SqlCommand cmd = new SqlCommand();
         cmd.Connection = con;
         cmd.CommandText = "INSERT into DataToPdf (Data) values ('" + dataToSave + "')";
         try
         {
            con.Open();
            cmd.ExecuteNonQuery();
         }
         catch (Exception ex)
         { }
         finally
         {
              con.Close();
         }
    }
 }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900