Решение:

В самом UserControl:

<link href="<%= GetCssUrl() %>" rel="stylesheet" type="text/css" />
private string _cssFile = "Calculator.css";
public string CssFile
{
set { _cssFile = value; } get { return _cssFile; } } public string GetCssUrl() { string cssRoot = System.Web.VirtualPathUtility.ToAbsolute("~/Controls/Gallery"); string result = string.Format("{0}/{1}", cssRoot, СssFile); return result; }

На целевой странице:

<uc1:Calculator ID="Calculator1" runat="server" CssFile="PrintCalculator.css" />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

protected void Button1_Click(object sender, EventArgs e)
{
Calculator1.CssFile = "Calculator.css";

 

Опубликовано в ASP.NET