public override void Validate() { // Validate page base.Validate(); if (Page.IsValid) { foreach (GridViewRow row in grdvJls.Rows) { // Verify new distance int companyId = int.Parse(hdfCompanyId.Value); int assetId = int.Parse(((HiddenField)row.FindControl("hdfAssetId")).Value); string length = ((TextBox)row.FindControl("tbxLength")).Text.Trim(); AssetSewerSection assetSewerSection = new AssetSewerSection(null); if (!assetSewerSection.VerifyNewLengthByAssetId(length, assetId, companyId)) { ((CustomValidator)row.FindControl("cvLength2")).IsValid = false; } } } }
protected void cvValidLength_ServerValidate(object source, ServerValidateEventArgs args) { int assetId = Int32.Parse(hdfAssetId.Value); int companyId = Int32.Parse(hdfCompanyId.Value); AssetSewerSection assetSewerSection = new AssetSewerSection(); if (assetSewerSection.VerifyNewLengthByAssetId(tbxVideoLength.Text, assetId, companyId)) { args.IsValid = true; } else { args.IsValid = false; hdfErrorFieldList.Value = hdfErrorFieldList.Value + ", Length"; } }