private void InitGridWeb()
{
// ExStart:WriteClientSideScript
// Assigning the name of JavaScript function to OnSubmitClientFunction property of GridWeb
GridWeb1.OnSubmitClientFunction = "ConfirmFunction";
// Assigning the name of JavaScript function to OnValidationErrorClientFunction property of GridWeb
GridWeb1.OnValidationErrorClientFunction = "ValidationErrorFunction";
// Accessing the cells collection of the worksheet that is currently active
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];
// Accessing "B1" cell and add some text
GridCell cell = sheet.Cells[0, 1];
cell.PutValue("Date (yyyy-mm-dd):");
// Accessing "C1" cell and add to it custom expression validation to accept dates in yyyy-mm-dd format
cell = sheet.Cells[0, 2];
var validation = cell.CreateValidation(GridValidationType.CustomExpression, true);
validation.RegEx = @"\d{4}-\d{2}-\d{2}";
// ExEnd:WriteClientSideScript
}