I have a datagrid to which I am dynamically adding a textbox and then a regularexpressionvalidator, however when the page loads i get a javscipt error on the line of code generated by the framework (See below)
e.Item.Cells[3].Controls.Add(AddNewPayRate(js, pr));
e.Item.Cells[3].Controls.Add(AddRegEx((TextBox)e.Item.Cells[3].Controls[0]));
private RegularExpressionValidator AddRegEx(TextBox txt)
{
RegularExpressionValidator reg = new RegularExpressionValidator();
reg.ControlToValidate = txt.ID;
reg.ErrorMessage = "Pay Rate must be numeric";
reg.ValidationExpression = @"^[0-9\.]+$";
reg.Display = ValidatorDisplay.None;
return reg;
}
Then the error is flagged up on the following line of code when the page is loaded: <script type="text/javascript">
<!--
var Page_ValidationSummaries = new Array(document.getElementById("vldSummary"));
var Page_Validators = new Array(document.getElementById("summaryDG_js4-5-7_ctl00"), document.getElementById("summaryDG_js17-5-7_ctl00"), document.getElementById("summaryDG_js13-5-7_ctl00"));
// -->
</script>
Any help would be most appreciated
It's all fun and games until someone loses an eye, then it's just fun and games you can't see.