Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2325
Cannot set cell value
posted

I have an ultragrid with a double click event:

  void grdMain_DoubleClickRow(object sender, DoubleClickRowEventArgs e)
  {
    EditNotes(e.Row);
  } 

private void EditNotes(UltraGridRow pRow)
{
 try
 {
  var frm = new FrmDialogEditNotes
  {
   Notes = pRow.Cells["Notes"].Value.ToString(),
   NoteType = pRow.Cells["Description"].Value.ToString(),
   VersionNumber = ApplicationSettings.ActiveScenarioNumber,
   WindowState = FormWindowState.Maximized,
   SetSaveDisabled = false
  };

  if (frm.ShowDialog(this) != DialogResult.OK) return;

  pRow.Cells["Notes"].Value = frm.Notes;
    }
    catch (Exception ex)
 {
  ExceptionPolicy.HandleException(ex, "Exception Policy");
 }
}  

WHen I double click the cell I get my notes dialog and I make some notes and click the save button and when it exits it tries to set the cells value but I get an error "Specified cast is not valid"

The underlying data is an NVARCHAR(MAX) and there are no NULLs for the notes record.  So I am at a loss.  Frm.Notes is string property.

Any thoughts?