This is a migrated thread and some comments may be shown as answers.

Conditionally supress the background image in the Black skin

4 Answers 51 Views
Input
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 12 Dec 2011, 04:47 PM
I've got a control based on the RadTextbox.

My control has a IsMandatory property and I'm doing something like this in the control...
protected override void OnPreRender(EventArgs e)
{
    base.OnPreRender(e);
    if (isMandatory)
    {
        RadTextBox1.EnabledStyle.BackColor = System.Drawing.Color.Pink;
    }
}
This works a treat.

Except when the skin is Black. The black skin renders an image in the background of the textbox.

I need to supress this when my input control has IsMandatory = true

--
Stuart

4 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 13 Dec 2011, 01:07 PM
I perhaps should have said, for the casual reader, that 'background (or background-image) isn't available as a property to set on the 'EnabledStyle' property.

--
Stuart
0
Kevin
Top achievements
Rank 2
answered on 14 Dec 2011, 02:34 PM
Hello Stuart,

I'm assuming it would be easier to suppress the background-image if you set the CssClass used by the EnabledStyle. Then in the css style, you could highlight it pink and hide the background-image.
0
Accepted
Tsvetina
Telerik team
answered on 14 Dec 2011, 02:47 PM
Hello Stuart,

As Kevin also said, you should use a CSS rule to overwrite the background image. The following should work for you:
protected override void OnPreRender(EventArgs e)
{
    base.OnPreRender(e);
    if (isMandatory)
    {
        RadTextBox1.EnabledStyle.CssClass = "custom";  
    }
}
html body span.RadInput input.custom
{
    background:pink;
}

The above CSS rule will be applied regardless of the skin chosen.

Greetings,
Tsvetina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Stuart Hemming
Top achievements
Rank 2
answered on 19 Dec 2011, 10:32 AM
Kevin, Tsvetina,

Thanks both for the suggestions.

I had tried changing the style that way, but hadn't gottent the selector right.

I have it now.

Many thanks

--
Stuart
Tags
Input
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
Kevin
Top achievements
Rank 2
Tsvetina
Telerik team
Share this question
or