Sergio Tapia Sergio Tapia - 1 month ago 13
ASP.NET (C#) Question

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?

Answer

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.

Comments