FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > BaseCellType Class : Validators Property |
'Declaration Public Overridable ReadOnly Property Validators As ValidatorCollection
'Usage Dim instance As BaseCellType Dim value As ValidatorCollection value = instance.Validators
public virtual ValidatorCollection Validators {get;}
// Add this section to the ASPX page <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator> <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="CompareValidator"></asp:CompareValidator> <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="RangeValidator"></asp:RangeValidator> protected void Page_Load(object sender, System.EventArgs e) { if (IsPostBack) return; FpSpread1.Sheets[0].RowCount = 10; FpSpread1.Sheets[0].ColumnCount = 7; // RequiredFieldValidator, from code FarPoint.Web.Spread.TextCellType txt1 = new FarPoint.Web.Spread.TextCellType(); RequiredFieldValidator rfv = new RequiredFieldValidator(); rfv.ErrorMessage = "RequiredFieldValidator, from code: value required!"; txt1.Validators.Add(rfv); FpSpread1.ActiveSheetView.Cells[0, 0].Text = "RequiredFieldValidator, from code"; FpSpread1.ActiveSheetView.Cells[0, 1].CellType = txt1; // RequiredFieldValidator, from toolbox FarPoint.Web.Spread.TextCellType txt2 = new FarPoint.Web.Spread.TextCellType(); RequiredFieldValidator1.ErrorMessage = "RequiredFieldValidator, from toolbox: value required!"; txt2.Validators.Add(RequiredFieldValidator1); FpSpread1.ActiveSheetView.Cells[1, 0].Text = "RequiredFieldValidator, from toolbox"; FpSpread1.ActiveSheetView.Cells[1, 1].CellType = txt2; // CompareValidator, from toolbox FarPoint.Web.Spread.TextCellType txt3 = new FarPoint.Web.Spread.TextCellType(); CompareValidator1.ErrorMessage = "CompareValidator, from toolbox: password does not match! Enter \"Spread\""; CompareValidator1.ValueToCompare = "Spread"; txt3.Validators.Add(CompareValidator1); FpSpread1.ActiveSheetView.Cells[2, 0].Text = "CompareValidator, from toolbox"; FpSpread1.ActiveSheetView.Cells[2, 1].CellType = txt3; // CompareValidator, from code FarPoint.Web.Spread.TextCellType txt4 = new FarPoint.Web.Spread.TextCellType(); CompareValidator cv = new CompareValidator(); cv.ErrorMessage = "CompareValidator, from toolbox: password does not match! Enter \"Spread\""; cv.ValueToCompare = "Spread"; txt4.Validators.Add(cv); FpSpread1.ActiveSheetView.Cells[3, 0].Text = "CompareValidator, from code"; FpSpread1.ActiveSheetView.Cells[3, 1].CellType = txt4; // RangeValidator, from toolbox FarPoint.Web.Spread.TextCellType txt5 = new FarPoint.Web.Spread.TextCellType(); RangeValidator1.ErrorMessage = "RangeValidator, from toolbox: value should in range [10 - 15]"; RangeValidator1.MinimumValue = "10"; RangeValidator1.MaximumValue = "15"; RangeValidator1.Type = ValidationDataType.Integer; txt5.Validators.Add(RangeValidator1); FpSpread1.ActiveSheetView.Cells[4, 0].Text = "RangeValidator, from toolbox"; FpSpread1.ActiveSheetView.Cells[4, 1].CellType = txt5; // RangeValidator, from code FarPoint.Web.Spread.TextCellType txt6 = new FarPoint.Web.Spread.TextCellType(); RangeValidator rv = new RangeValidator(); rv.ErrorMessage = "RangeValidator, from toolbox: value should in range [10 - 15]"; rv.MinimumValue = "10"; rv.MaximumValue = "15"; rv.Type = ValidationDataType.Integer; txt6.Validators.Add(rv); FpSpread1.ActiveSheetView.Cells[5, 0].Text = "RangeValidator, from toolbox"; FpSpread1.ActiveSheetView.Cells[5, 1].CellType = txt6; }
'Add this section to the ASPX page <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator> <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="CompareValidator"></asp:CompareValidator> <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="RangeValidator"></asp:RangeValidator> Protected Sub Page_Load(sender As Object, e As System.EventArgs) If IsPostBack Then Return End If FpSpread1.Sheets(0).RowCount = 10 FpSpread1.Sheets(0).ColumnCount = 7 ' RequiredFieldValidator, from code Dim txt1 As New FarPoint.Web.Spread.TextCellType() Dim rfv As New RequiredFieldValidator() rfv.ErrorMessage = "RequiredFieldValidator, from code: value required!" txt1.Validators.Add(rfv) FpSpread1.ActiveSheetView.Cells(0, 0).Text = "RequiredFieldValidator, from code" FpSpread1.ActiveSheetView.Cells(0, 1).CellType = txt1 ' RequiredFieldValidator, from toolbox Dim txt2 As New FarPoint.Web.Spread.TextCellType() RequiredFieldValidator1.ErrorMessage = "RequiredFieldValidator, from toolbox: value required!" txt2.Validators.Add(RequiredFieldValidator1) FpSpread1.ActiveSheetView.Cells(1, 0).Text = "RequiredFieldValidator, from toolbox" FpSpread1.ActiveSheetView.Cells(1, 1).CellType = txt2 ' CompareValidator, from toolbox Dim txt3 As New FarPoint.Web.Spread.TextCellType() CompareValidator1.ErrorMessage = "CompareValidator, from toolbox: password does not match! Enter ""Spread""" CompareValidator1.ValueToCompare = "Spread" txt3.Validators.Add(CompareValidator1) FpSpread1.ActiveSheetView.Cells(2, 0).Text = "CompareValidator, from toolbox" FpSpread1.ActiveSheetView.Cells(2, 1).CellType = txt3 ' CompareValidator, from code Dim txt4 As New FarPoint.Web.Spread.TextCellType() Dim cv As New CompareValidator() cv.ErrorMessage = "CompareValidator, from toolbox: password does not match! Enter ""Spread""" cv.ValueToCompare = "Spread" txt4.Validators.Add(cv) FpSpread1.ActiveSheetView.Cells(3, 0).Text = "CompareValidator, from code" FpSpread1.ActiveSheetView.Cells(3, 1).CellType = txt4 ' RangeValidator, from toolbox Dim txt5 As New FarPoint.Web.Spread.TextCellType() RangeValidator1.ErrorMessage = "RangeValidator, from toolbox: value should in range [10 - 15]" RangeValidator1.MinimumValue = "10" RangeValidator1.MaximumValue = "15" RangeValidator1.Type = ValidationDataType.[Integer] txt5.Validators.Add(RangeValidator1) FpSpread1.ActiveSheetView.Cells(4, 0).Text = "RangeValidator, from toolbox" FpSpread1.ActiveSheetView.Cells(4, 1).CellType = txt5 ' RangeValidator, from code Dim txt6 As New FarPoint.Web.Spread.TextCellType() Dim rv As New RangeValidator() rv.ErrorMessage = "RangeValidator, from toolbox: value should in range [10 - 15]" rv.MinimumValue = "10" rv.MaximumValue = "15" rv.Type = ValidationDataType.[Integer] txt6.Validators.Add(rv) FpSpread1.ActiveSheetView.Cells(5, 0).Text = "RangeValidator, from toolbox" FpSpread1.ActiveSheetView.Cells(5, 1).CellType = txt6 End Sub
Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6