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?

Parents
  • 48586
    posted

    Hello ,

    Have you tried to set same string directly to the cell value instead going through the dialog form ? What is the result ? What is the string that you trying to add to this cell ? What is the type of the UltraWinGridColumn (pRow.Cells["Notes"].Column.DataType) ?  have you tried to isolate this in a separate sample ?

     

    I am waiting for your feedback.

Reply Children