Author: Kriswd40 | Posted on: 7/24/2009 10:58:01 AM | Views : 577

 I have a dynamically created label that I need to apply a CssClass (defined in a stylesheet as "errorMessage") to but am having trouble getting it to work. Below are two methods I have tried:
            Label errorMessage = new Label();
            errorMessage.Attributes.Add("class","errorMessage");
            this.Controls.Add(this.errorMessage);
            Label errorMessage = new Label();
            errorMessage.CssClass = "errorMessage";
            this.Controls.Add(this.errorMessage);
Both instances cause no errors, but if I check the value of either ...

Go to the complete details ...