Monday, 29 December 2014

How to add multiple css class to one ASP.NET control?

Scenario : Adding multiple CSS classes to one control in ASP.NET

This is basic one adding mutliple CSS classes to any Control in ASP.NET and should know this by all developers.

<style typ'text\css'>

.class1{
border:2px solid #fff;
}

.class2{
color:red;
}

</style>


Now, we are going to add the above two CSS classes to ASP.NET Textbox control.


 <asp:TextBox ID="txtboxOwnerContent" runat="server" Height="18px" Width="302px" CssClass="class1 class2"/>

Explanation : We can add as many as CSS Classes with space separation into CssClass attribute for TextBox Control. Not only for this Control, similar way adding classes for all other ASP.NET controls.


That's it,

Happy Coding:)