Search code examples
c#asp.netcssasp.net-mvc-2ascx

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


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?


Solution

  • 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.