Can a Web User Control (.ascx) use a CSS file for styling?

Sergio Tapia picture Sergio Tapia · Jun 27, 2010 · Viewed 14.9k times · Source

Here's the source of a blank .acsx file I created called LogOnBox.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LogOnBox.ascx.cs" Inherits="ECommerce.Views.Shared.LogOnBox" %>

I want to drag some labels, and textboxes etc and give them style using a CSS file. How can I associate a CSS to an acsx file?

Answer

Arjan Einbu picture Arjan Einbu · Jun 27, 2010

The CSS is associated to the page, and not the control specifically. But you can use the CSS in the control when the page has referenced it.