Hi,
I am trying to implement RadSwitch in a Web Forms application. I copied the CSS from the Telerik Demo. When I apply the CSS class to a RadSwitch contained directly in the web form, it displays correctly. However, when I apply the same class to a RadSwitch contained in a web user control, it doesn’t display correctly.
I have tried several workarounds, including copying the CSS and embedding it into the web user control, but nothing works. The RadSwitch still displays incorrectly. The web user control and the RadSwitch that displays correctly are not in the same web form.
Here is the CSS:
/*Create elastic RadSwitch*/
.RadButton.RadSwitch.elasticSwitch .k-switch-handle {
width: 2em !important;
height: 2em !important;
display: flex !important;
}
.RadButton.RadSwitch.k-switch-on.elasticSwitch .k-switch-handle {
left: calc( 100% - 2em) !important;
display: flex !important;
}
.RadButton.RadSwitch.elasticSwitch,
.RadButton.RadSwitch.elasticSwitch .k-switch-container {
width: 4em !important;
display: flex !important;
}
Here are the CSS references for the web form and the web user control:
Web form CSS reference:
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<link href="<%= Page.ResolveUrl("~/CSS/Custom.css") %>" rel="stylesheet" type="text/css" />
</asp:Content>
Web user control CSS reference:
<link href="<%= Page.ResolveUrl("~/CSS/Custom.css") %>" rel="stylesheet" type="text/css" />
Here is the HTML for the correctly displaying RadSwitch:
<telerik:RadSwitch runat="server" ID="TipoRequerimientoRequiereAcuse" Checked="false"
CssClass="elasticSwitch"
AutoPostBack="false">
</telerik:RadSwitch>
And here is the HTML for the RadSwich in the web user control:
<telerik:RadSwitch runat="server" ID="chkInformativo" Checked="false"
CssClass="elasticSwitch"
AutoPostBack="false">
</telerik:RadSwitch>
Has anyone else experienced this situation before? How did you solve it?