Mar 07, 2016, 11:52 AM
Change background of DateField via code behind
Hello, I have a problem changing the background of a DateField (the DateFieldTo in the aspx code) in the codebehind...
This is my aspx code:
and this is what I want to achieve:
I've tried:
This is my aspx code:
<ext:FieldContainer ID="FieldContainer2" runat="server" FieldLabel='Validity Period' Split="true" Layout="ColumnLayout">
<Items>
<ext:DateField runat="server" ID="DateFieldFrom"
ColumnWidth=".5" MinWidth="100" Vtype="daterange"
PaddingSpec="0 3 0 0" Name="ValidFrom" AllowBlank="false">
<CustomConfig>
<ext:ConfigItem Name="endDateField" Value="DateFieldTo" Mode="Value" />
</CustomConfig>
</ext:DateField>
<ext:Label ID="Label2" runat="server" Text='-' />
<%--This is the DateField that I want to change the background--%>
<ext:DateField runat="server" ID="DateFieldTo"
ColumnWidth=".5" MinWidth="100" Vtype="daterange"
PaddingSpec="0 0 0 3" Name="ValidTo" AllowBlank="true">
<CustomConfig>
<ext:ConfigItem Name="startDateField" Value="DateFieldFrom" Mode="Value" />
</CustomConfig>
</ext:DateField>
</Items>
</ext:FieldContainer>
this is what the code generates:and this is what I want to achieve:
I've tried:
DateFieldTo.SetFieldStyle("background-color: rgb(255, 243, 199) !important;");
but it doesn't work in Chrome and Firefox, am I doing something wrong?