ASP.NET

Validation Control:-

Validation Controls are used to validate user input.
Types
Description
Compare Validator
Compares value between one input control to another input control
Range Validator
Checks that the user enters a value between specified range.
Regular Expression Validator
Checks that the value of an input control matches a specified expressionpattern.
Custom Validator
Allows you to write a method to validate value entered.
Required Field Validator
Makes a input field required field.
Validation Summary
Displays a report of all validation errors occured in webpage.

Regular Expression Validation 
  • For  Only Alphabets:-
    • [a-zA-Z\s]+$
    • [a-zA-Z\s]{1,50}
  • For Only Numbers:-
    • ^\d+$
    • ^[0-9]{6,12}+$
  • To Validate Mobile Number:-
    • [0-9]{10}
  • To Validate Date:-
    • [0-9m]{1,2}/[0-9d]{1,2}/[0-9y]{4}+$
  • For Money Format or Decimal Plaxes:-
    • ^\d{1,3}(\.\d{0,4})?$
  •  
  
Crystal Report
In .aspx.cs write the following code to get data in crystal report in web page. From Reporting Take CrystalReportViewer.

RPT=crystalreport1.rpt;
strSelect = "Select * from Table1";
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(strSelect, con);
da.Fill(ds, "Table1");
ReportDocument ReportDoc1= new ReportDocument();
string reportPath = Server.MapPath(RPT);
ReportDoc1.Load(reportPath);
ReportDoc1.SetDataSource(ds.Tables["Table1"]);
CrystalReportViewer1.ReportSource = ReportDoc1;

No comments:

Post a Comment