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

Convert Gridgroupingcontrol.table.currentrecord into single datarow

Dear All :


While I try to write a code update some value into GGC current selected record
But it state that GridGroupingControl,table.currentrecord is read only object and cannot be update

For this case, can you tell me how to convert GridGroupingControl,table.currentrecord into datarow, So I can update the value in the select row of GCC

Thanks for your help 


Michael

3 Replies

PM Piruthiviraj Malaimelraj Syncfusion Team June 27, 2016 10:00 AM UTC

Hi Michael, 
 
Thank you for using Syncfusion products. 
 
Query 
Solution 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Can you tell me how to convert GridGroupingControl,table.currentrecord into datarow, So I can update the value in the select row of GCC 
Suggestion - 1 
 
Using GetData() method: 
 
The data row can be retrieved and it can be updated for the current record value by using GetData() method. Please make use of below code. 
 
Code snippet 
private void button1_Click(object sender, EventArgs e) 
    //Using GetData() method 
    if (this.gridGroupingControl1.Table.CurrentRecord != null
    { 
        DataRowView dataRowView = this.gridGroupingControl1.Table.CurrentRecord.GetData() as DataRowView
        dataRowView.Row["Col1"] = "NewValue"
    }     
} 
 
 
Suggestion  - 2 
 
Using SetValue() method: 
 
The current record value can be updated by using SetValue() method. Please make use of below code. 
 
Code snippet 
private void button1_Click(object sender, EventArgs e) 
    //Using SetValue() method. 
    if (this.gridGroupingControl1.Table.CurrentRecord != null
    { 
        this.gridGroupingControl1.Table.CurrentRecord.SetValue("Col1", "NewValue"); 
    }   
} 
 
Sample link 

Regards, 
Piruthiviraj 



MK Michael K June 27, 2016 03:07 PM UTC

Dear Piruthiviraj 

Get it, thanks for your help

Michael


PM Piruthiviraj Malaimelraj Syncfusion Team June 28, 2016 04:51 AM UTC

Hi Michael, 

We are glad to hear from you that the given solution is resolved your problem. Please let us know if you have any other queries. 

Regards, 
Piruthiviraj 


Loader.
Up arrow icon