FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > TextCellType Class : AllowServerValidators Property |
'Declaration Public Property AllowServerValidators As Boolean
'Usage Dim instance As TextCellType Dim value As Boolean instance.AllowServerValidators = value value = instance.AllowServerValidators
public bool AllowServerValidators {get; set;}
<FarPoint:FpSpread ID="FpSpread1" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Height="200" Width="400"> <commandbar backcolor="Control" buttonfacecolor="Control" buttonhighlightcolor="ControlLightLight" buttonshadowcolor="ControlDark"></commandbar> <sheets> <FarPoint:SheetView SheetName="Sheet1"></FarPoint:SheetView> </sheets> </FarPoint:FpSpread> <asp:CustomValidator ID="CustomValidator2" runat="server" ErrorMessage="Error of server side" OnServerValidate="CustomValidator2_ServerValidate"></asp:CustomValidator> protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; TextCellType txt = new FarPoint.Web.Spread.TextCellType(); txt.AllowServerValidators = true; txt.Validators.Add(CustomValidator2); FpSpread1.ActiveSheetView.Cells[1, 1].CellType = txt; FpSpread1.ActiveSheetView.Cells[1, 1].BackColor = Color.LightPink; } protected void CustomValidator2_ServerValidate(object source, ServerValidateEventArgs args) { int value = 0; args.IsValid = int.TryParse(args.Value, out value) && value < 10;// Accept integer number less than 10; }
<FarPoint:FpSpread ID="FpSpread1" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Height="200" Width="400"> <commandbar backcolor="Control" buttonfacecolor="Control" buttonhighlightcolor="ControlLightLight" buttonshadowcolor="ControlDark"></commandbar> <sheets> <FarPoint:SheetView SheetName="Sheet1"></FarPoint:SheetView> </sheets> </FarPoint:FpSpread> <asp:CustomValidator ID="CustomValidator2" runat="server" ErrorMessage="Error of server side" OnServerValidate="CustomValidator2_ServerValidate"></asp:CustomValidator> Protected Sub Page_Load(sender As Object, e As System.EventArgs) If IsPostBack Then Return Dim txt As New FarPoint.Web.Spread.TextCellType() txt.AllowServerValidators = True 'New property to enable server validating with validator controls txt.Validators.Add(CustomValidator2) FpSpread1.ActiveSheetView.Cells(1, 1).CellType = txt FpSpread1.ActiveSheetView.Cells(1, 1).BackColor = Color.LightPink End Sub Protected Sub CustomValidator2_ServerValidate(source As Object, args As ServerValidateEventArgs) Dim value As Integer = 0 args.IsValid = Integer.TryParse(args.Value, value) AndAlso value < 10 'Accept integer number less than 10 End Sub
Target Platforms: Windows 7, Windows 8, Windows 10, Windows Vista, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP Professional