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
close icon

How can I set the value of a cell

I am using the PivotGrid for data input. If a user does not enter a numeric value in the cell I want to clear out the value that was just entered. How can I set the value of the current cell?

1 Reply

SP Subburaj Pandian Veluchamy Syncfusion Team August 5, 2019 11:25 AM UTC

Hi George,

We have analyzed the reported query “How to restrict the string values while editing the cell value”. By default, we have converted the edited cell value into ‘Double’ type. If you have edited the cell value by using numeric string, the cell value automatically convert into zero using pivot editing manager). Suppose if you want to customize the entered string value, you should do the following changes in your application (applicable for defining the custom editing manager). 
Please refer the following code sample, 
# Form1.vb 
                Public Class CustomEditingManager 
                                Inherits PivotEditingManager 
                                Public Sub New(ByVal pg As PivotGridControlBase) 
                                End Sub 
        Protected Overrides Sub ChangeValue(ByVal oldValue As ObjectByVal newValue As ObjectByVal row1 As IntegerByVal col1 As IntegerByVal pi As PivotCellInfo) 
            If Not System.Text.RegularExpressions.Regex.IsMatch(newValue, "^\d+$"Then 
                newValue = 0 
            End If 
            'do the base change 
            MyBase.ChangeValue(oldValue, newValue, row1, col1, pi) 
            ''mark all the adjusted cell contents 
            'pi.FormattedText &= "*" 
        End Sub 
    End Class 

If the above solution does not resolve your actual requirement could you please share the detailed description about your requirement along with screenshots, so that it could be helpful to provide the solution at the earliest. 
Subburaj Pandian V  

Live Chat Icon For mobile
Up arrow icon