below is my code
***
//function returns bool if cell is empty
chekemfield =checkemptyfield();
if(chekemfield ==true)
{
MessageBox.Show("Field must be
entered","V-1550",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Error);
ultraGrid1.ActiveRow=ultraGrid1.Rows[actrowinx];
Infragistics.Win.UltraWinGrid.UltraGridCell acell;
acell = ultraGrid1.ActiveRow.Cells["INSULATION_DUTY"];
ultraGrid1.ActiveCell = acell;
ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
//function
public bool checkemptyfield()
{
string duty=ultraGrid1.ActiveRow.Cells["INSULATION_DUTY"].Value.ToString();
string
material=ultraGrid1.ActiveRow.Cells["INSULATION_MATERIAL"].Value.ToString();
if(duty==string.Empty || material==string.Empty)
{
chekemfield=true;
return chekemfield;
}
else
{
chekemfield=false;
return chekemfield;
}
}
****
can anyone help me
--
We cannot find solution but will arise from SuperConscious.
Regards
Prabakar
Try the BeforeExitEditMode event to validate the contents of the cell.
private void ultraGrid1_BeforeExitEditMode(object sender,
Infragistics.Win.UltraWinGrid.BeforeExitEditModeEventArgs e)
{
//...make sure the parent form is not disposing otherwise
//the MessageBox call will allow the process to "live on"
//after the form has disposed and dissapeared from the
//user's view.
if(!Disposing)
{
//...get the cell the user is editing...
Infragistics.Win.UltraWinGrid.UltraGridCell theCell =
((Infragistics.Win.UltraWinGrid.UltraGrid)sender).ActiveCell;
if(theCell.Column.Key == "MyColumn")
{
//perform some validation...
if(theCell.Text.Length == 0)
{
//cancel the "exit edit mode" event.
e.Cancel = true;
//alert the end user with a validation error
MessageBox.Show("Error Message", "Error Caption",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
Regards,
GM
http://nonspect.com