Monday 1 August 2011

Why does adding two CSS classes in code-behind, using CssClass attributes onld add one???

Adding a space in the middle of the CssClass property string results in the the string being Right Trimmed and only the first string being set as the css class property on the rendered HTML element:

        pnlCntrl.CssClass = "alt repeaterRow"

However, using the assignment addition operator, gives the correct results:

        pnlCntrl.CssClass = "alt"
        pnlCntrl.CssClass += " repeaterRow"

No comments:

Post a Comment