I have a created a user control that is hopefully going to be used across several sites. The problem that I am having is that these sites may all have different color schemes. I was wondering how I might be able to make a template for the control, and then based on the developer’s site, they will pass a parameter that indicates the color scheme they require, and the user control will update appropriately. I am very new to .NET, so please bear with me if this is a trivial question. I tried researching online, but most examples were either more complex, or just changed colors of panels, instead of changing css styles.
The control (.ascx) is as listed below:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="EmployeeSearch.ascx.cs" Inherits="Controls_EmployeeSearch" ClassName="EmployeeSearch" %>
<div id="divUserEntry" runat="server">
<center>
<br />
<!-- This is the title for the employee search-->
<div id="employeeTitle" class="LookupTitle">
<center>Select Employee</center>
</div>
<!-- Div for the actual search elements -->
<div id="searchPeople" class="searchPeople">
<div id="addedPerson" class="addedPerson">
</div>
<asp:TextBox ID="txtUserEntry" class="searchTextBox" runat="server" Text="Enter Name or ID" onFocus="this.value = ''" CssClass="searchTextStyle"></asp:TextBox>
<asp:HiddenField ID="currentSearch" name="currentSearch" Value="notANormalValue" />
<div id="searchResults" class="searchResults">
Search for employee to manage.
</div>
</div>
<br />
<asp:Button ID="btnSubmitEmployee" runat="server" Text="Submit" />
</center>
</div>
Then I register it like this:
<%@ Register TagPrefix="uc" TagName="EmployeeSearch" Src="~/Controls/EmployeeSearch.ascx" %>
and just call it with this:
<uc:EmployeeSearch ID="searchContent" runat="server" />
I know that I can add a property in the uc call, but I am not sure what to do to get the divs to update correctly. Does anyone have a suggestion? Thanks in advance!
usercontrols inherit the css from the aspx or site.master pages so what you could do is in each css either add
or set a css class and then your div
but still in each css they have to add