We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Query Related to AddNewRecordBeforeDetails

Hi,
I am using grid grouping control with AddNewRecordBeforeDetails property is true.I have two queries related to this property.
1)when i entered some value in any column and backspace it on enter key press it also adds blank record in grid grouping control.I don't want any blank row .
2) I want to add new record based on certain condition only,
such as,
 If the combo box column in my grid having value


Thanks and Regards,
paurnima.






1 Reply

PM Piruthiviraj Malaimelraj Syncfusion Team October 10, 2016 12:35 PM UTC

Hi Paurnima, 

Thanks for your interest in Syncfusion products. 

We had analyzed your reported scenario. In order to  add the new record based on some criteria , you can use RecordValueChanging event and you can check record kind by using Record.Kind property. Please make use of the below code and refer to the attached sample. 
 
Code example 
this.gridGroupingControl1.RecordValueChanging += new RecordValueChangingEventHandler(gridGroupingControl1_RecordValueChanging); 
 
void gridGroupingControl1_RecordValueChanging(object sender, RecordValueChangingEventArgs e) 
{ 
    if (e.Record.Kind == DisplayElementKind.AddNewRecord) 
    { 
        GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; 
 
        object value = e.Record.GetValue("CategoryName"); 
 
        if (cc.MoveToRowIndex != cc.MoveFromRowIndex) 
        { 
            if (value == null) 
            { 
                e.Cancel = true; 
            } 
        } 
    } 
} 
 
Sample link 
 
Regards, 
Piruthiviraj 
 


Loader.
Up arrow icon