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

Problem Cancelling AddNewRow And Masking Grid Column

Hi Syncfusion Team,

1.
I tried the following link and the example provided for using Reflection in refreshing the grid but it is not working.

I have the same requirements, when you press ESCAPE key, it will cancel the current line and should show 'Click here to add...'
Right now, the provided example is showing a blank grid.  See attached screenshot.

Using VS2019 Enterprise and WF 17.3.0.14


2.
How can I use masking in GridTextColumn?
Or any other way to mask a column?

Input: 12120202
Masking: 12-12-0202


Thanks.

Attachment: Grid_Screenshot_a2f14985.zip

2 Replies

ER ER February 5, 2020 12:27 PM UTC

Hi Syncfusion,

No possible solution yet to the questions?


Thanks.


SA Saravanan Ayyanar Syncfusion Team February 5, 2020 02:19 PM UTC

Hi ER, 
 
Thank you for using Syncfusion controls. 
 
Query 1: 
 
We are prepared the sample for your requirement of “when press Escape key, it will cancel the current line and should show ‘Click here to add…’ ”. Please find the sample link below. 
 
Sample Link: 
 
Query 2: 
 
You can achieve your requirement of “masking in GridTextColumn” by using the SfDataGrid.DrawCell event. Please refer the code snippet below. 
 
this.sfDataGrid1.DrawCell += SfDataGrid1_DrawCell; 
 
private void SfDataGrid1_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e) 
 { 
    if(e.Column.MappingName=="CusDate") 
     {                 
         string str1=e.DisplayText; 
         string str2 = string.Empty; 
         for(int i=0;i<str1.Length;i++) 
         { 
             str2 += str1[i]; 
             if (i == 1 || i == 3) 
                 str2 += "-"; 
         } 
         e.DisplayText = str2; 
     } 
 } 
 
 
Sample Link: 
 
Please let us know, if you require further assistance on this. 
 
Regards, 
Saravanan A. 


Loader.
Live Chat Icon For mobile
Up arrow icon