Click here to Skip to main content
15,173,454 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
C#
public override void RenderBeginTag(HtmlTextWriter writer)
        {            
            // Set the maxlength and the min length using regex for multiline textboxes...
            RegularExpressionValidator rev = new RegularExpressionValidator { ControlToValidate = ClientID, ValidationExpression = @"^[\s\S]{" + MinLength + "," + (MaxLength == 0 ? 1000000 : MaxLength) + "}$", ErrorMessage = "Please enter a valid length." };
            this.Parent.Controls.Add(rev);
// The prev line is giving error:
// Collection was modified; enumeration operation may not execute.
// Even tried the above in Onprerender also, but no luck.

            base.RenderBeginTag(writer);
        }
Posted
Updated 2-Mar-10 19:36pm
v2

1 solution

You want a user control, not a custom control. What you're doing is a bit of a hack, you're using the wrong tools for the job.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900