I am creating ASP.NET textbox controls dynamically. I want to know the difference between assigning the property of the control and adding it as an attribute.
For ex: I can do:
TextBox txtBox = new TextBox(); txtBox.MaxLength = 100;
or I could do
txtBox.Attributes.Add('maxlength', '100);
The first example is strongly typed, so the compiler will check to make sure that a) MaxLength exists and b) an integer is set for that property.
The second example will work, but the compiler has no way to check to see if the attribute you are adding is correct.